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

How do I pass a string to sub init() of XML file?

I need to pass a string to sub init() or any other function or field of a LabelList XML file. How do I do that? Thanks for your help!
0 Kudos
2 Replies
destruk
Level 10

Re: How do I pass a string to sub init() of XML file?

Init is executed when the component is compiled, so I wouldn't think you would be able to 'pass' a value into it in Init from outside the component.  To set a variable within the init function you would just do that -- m.temp="Hello"

You would be able to pass values into compiled components by making the value global so the component can pull from the global namespace, or by setting up a field in the xml to transfer values in and out of the component.

<interface>
<field id="mydata" type="string" />
</interface>
0 Kudos
neowinston
Level 7

Re: How do I pass a string to sub init() of XML file?

Thank you!
0 Kudos