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.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Arezth
Visitor

Opening a scene from a .brs that is not main.brs

Hi Forum,

I am new to developing for Roku. I was looking for a way of calling (open) a scene (or screen) from within a scene (from an "roSGScreen" object) that has already been called in the main.brs. For what I've seen, the scene or screen should be initialized in the main.brs 's RunUserInterface, because it is not initialized if I tried to create one in the scene's .brs that has already been loaded. Also, it would need to be passed to the scene that is open, but I can't figure out how. Can you point me in the right direction? An example would be deeply appreciated.
0 Kudos
4 REPLIES 4
EnTerr
Roku Guru

Re: Opening a scene from a .brs that is not main.brs

There seems to be general agreement amongst RSG experts that one should not try to use more than one Scene - instead use different Group nodes under the one and only scene. I.e. make your logical screens/scenes inherit from Group and replace one as a child with the other under the-one-and-only Scene. Or attach them both but flip the visible bit on each to transition
0 Kudos
Arezth
Visitor

Re: Opening a scene from a .brs that is not main.brs

"EnTerr" wrote:
There seems to be general agreement amongst RSG experts that one should not try to use more than one Scene - instead use different Group nodes under the one and only scene. I.e. make your logical screens/scenes inherit from Group and replace one as a child with the other under the-one-and-only Scene. Or attach them both but flip the visible bit on each to transition

Thank you very much for your reply! Okay, then I will just use the initial scene. So, the logic of how the screens should open up should be in the main.brs... would you recommend to read the message from the port in order to establish when to open which the scene? Is there a way to share information between scenes?
For example, right now I have a working scene in which movies are displayed and played when selected, but I still need to add a category for the series. I wanted to open a second scene containing the information and episodes of them based on the selected item. Maybe my approach is wrong.
Also, I wanted to add a middle scene in which the user can select if they want subtitles and else, another reason why I wanted to be able to call other scenes.
0 Kudos
belltown
Roku Guru

Re: Opening a scene from a .brs that is not main.brs

I'd recommend you start by running through the Scene Graph Tutorial (Sliding Panels Markup tutorial, you may find that you have enough there to create a UI that doesn't need a lot of on-the-fly scene creation; you just create a PanelSet, and add Panels to it.

If that's not enough then work your way through the Sample Channels in the rokudev GitHub repo. You may find that the videoplayer-channel does something similar to what you're looking for to handle categories of videos.

It takes a while to grasp the fundamental architecture of Scene Graph. You're not there yet. Maybe this will help.
0 Kudos
Arezth
Visitor

Re: Opening a scene from a .brs that is not main.brs

Thank you both for your advice! I ended up creating two grids and making them visible and invisible as one of the suggestions! Works fine for now.
0 Kudos