Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Streaming Star

switching between screens

ive been trying to switch been screens, home screen and details screen through a manager file but its not working for some reason and here is the code can anyone help?Screenshot 2023-02-21 at 7.57.10 PM.pngScreenshot 2023-02-21 at 7.57.21 PM.pngScreenshot 2023-02-21 at 7.57.37 PM.pngScreenshot 2023-02-21 at 7.57.43 PM.png

0 Kudos
Channel Surfer

Re: switching between screens

I'm not long into dealing with (learning) Roku, so pardon any non-applicable points.

First glance:

1. Your initscreenstack() in manager.brs doesn't appear to be called, so m.scenegroup isn't instanced.

2. Is the abstraction of [
manager.xml/brs] taking on a controlling duty, rather than the [mainscene.xml/brs], worth it? 

If so:

2b. Don't include the extra <script> for manager.brs in your mainscene.xml. When you want .brs scripts included by multiple components, make them separate .brs files not tied to any components. For example: if component.brs is serving as the script init() backing to component.xml, then don't include that in differentcomponent.xml, otherwise it leads to confusion with unclear context; make a separate shared.brs file.

2c. Then in manager.brs you can change initscreentstack() to init() and it won't conflict.

2d. Then in mainscene.brs at handling the back button, call your interface function for closeScreen: 
m.manager.callFunc("closeScreen"), as you did with showScreen, instead of closeScreen().

3. The mainscene.brs OnKeyEvent doesn't return the result. Though it does in your commented-out version.

Any luck?

Streaming Star

Re: switching between screens

yup thanks for that i got it and tried it and its not crashing but now the problem is that it is not displaying anything and when i tried to debug it returns an empty component Screenshot 2023-02-22 at 9.46.23 AM.pngScreenshot 2023-02-22 at 9.46.31 AM.pngScreenshot 2023-02-22 at 9.46.42 AM.pngScreenshot 2023-02-22 at 9.46.52 AM.png

<Component: roSGNode:Manager> =
    childRenderOrder: "last"
    clippingRect: <Component: roAssociativeArray>
    enableRenderTracking: false
    inheritParentOpacity: true
    inheritParentTransform: true
    muteAudioGuide: false
    opacity: 1
    renderPass: 0
    renderTracking: "disabled"
    rotation: 0
    scale: <Component: roArray>
    scaleRotateCenter: <Component: roArray>
    translation: <Component: roArray>
    visible: true
    change: <Component: roAssociativeArray>
    focusable: false
    focusedChild: <Component: roInvalid>
    id: ""
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.