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: 

scene graph componet -- passing variables

Is there a way to pass variables to a component at initialization? Or after? If I want some part of the component to be dynamic, is there a way to pass this information in? Can I use init() or do I have to make an aux function? Or something else like a message port?
0 Kudos
3 REPLIES 3
TheEndless
Channel Surfer

Re: scene graph componet -- passing variables

"strattonbrazil" wrote:
Is there a way to pass variables to a component at initialization? Or after? If I want some part of the component to be dynamic, is there a way to pass this information in? Can I use init() or do I have to make an aux function? Or something else like a message port?

You can create a custom interface field and set its value. Make sure you add an onChange function to it, so you can detect when the value is changed.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos

Re: scene graph componet -- passing variables

Thanks, this makes sense. How do I pass information/events back like if I want the component to close the current screen?
0 Kudos
TheEndless
Channel Surfer

Re: scene graph componet -- passing variables

"strattonbrazil" wrote:
Thanks, this makes sense. How do I pass information/events back like if I want the component to close the current screen?

You'd use the same method of adding an interface field. The difference is that you'd set the value from within the component, and listen for changes from the main BrightScript thread (via roSGNodeEvent).

Having said that, Roku engineers don't seem to recommend using multiple scenes/screens, per viewtopic.php?f=34&t=88621#p513504
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos