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: 
softworkz
Visitor

Re: How to programmatically exit out of scene graph's Scene?

"EnTerr" wrote:
Perhaps I should stop trying your patience 🙂 and figure out first hand if that can work with the live RSG, since "the best-laid plans of mice and men often go awry".

I apologize for my ignorance - I thought you were interested how I got it working while telling what you tried without success.. 🙂

Regarding ideas: I already had and tried so many that didn't work... Let's focus on what's actually working - hehe, but you should definitely try this because an unproofed concept is nothing worth!
0 Kudos
Motorcykey
Visitor

Re: How to programmatically exit out of scene graph's Scene?

Hey,

I'm looking for something similar, but having a hard time finding the answer. Is there anything you can call from within a Scene to exit (e.g., m.top.close would be nice, but is not there)

Much like the Original Poster, I can exit the Scene using the Back Button, but would also like to do so using a button I've created on the UI.

Is there any way to listen for when my button is clicked in the main .brs component so that I could call screen.Close() when I need to? It sounds like this is the solution that was posted here by setting an observer for "LaunchSubScene":

scene.observeField("LaunchSubScene", m.port)

But I'm a bit clueless as to where LaunchSubScene lives and how it gets called.
0 Kudos
Motorcykey
Visitor

Re: How to programmatically exit out of scene graph's Scene?

A-ha... all it was was adding an interface value to the component which could then be observed for any changes. I see. Very nice solution! Thanks!
0 Kudos
aloudmind
Visitor

Re: How to programmatically exit out of scene graph's Scene?

In case anyone is still having an issue with this... my solution was to add a label node to the main scene xml file:

<Label id="exitApp" translation="[0,0]" text="" />

Then in my main.brs file, I observe the text value of the label node:

m.exit_app = scene.findNode("exitApp")
m.exit_app.observeField("text", m.port)

When the node.text value changes to "true", I simply call:

screen.Close()

If there is an easier/cleaner way, please let me know.
0 Kudos
MuviDev
Binge Watcher

Re: How to programmatically exit out of scene graph's Scene?

return false; from the the back or any keyEvent that you want to handle

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.