Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
softworkz
Level 7

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

"EnTerr" wrote:
Perhaps I should stop trying your patience Smiley Happy 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.. Smiley Happy

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
Level 7

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
Level 7

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
Level 7

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