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: 

Passing data to the component

Hello everybody. 

I'm novice to Roku and BrightScript, so, my question in very simple.

How to pass some data to the component? What is regular way to it?

The constructor, init() method, can't has any parameters. 
This page says that component can gave only two built-in methods. Really? Is so, I can't add my own methods. 
I had dig in the documentation and samples, but didn't find the answer. 
0 Kudos
Roku Guru

Re: Passing data to the component

The component must specify <interface> elements.

To pass data to a component, set the interface value for that component.

To read data passed to it, the component uses an observer to listen for changes to its interface field.
0 Kudos

Re: Passing data to the component

This is too complex way. 
I found the 'functional fields'. This is like a regular methods. 
But supported only in SDK 7.5, it is suitable. 
0 Kudos

Re: Passing data to the component

belltown[/url:3ppr0kg0], I got your idea, thank you. 

The chain is:
1. Describe <interface><field> in xml.
2. In the code - set observer to this field. 

3. Set some value to the field.
4. Observer automatically invoked. 
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.