How to define a function in component interface on Roku(BrightScript/SceneGraph)
Uros Mitic
Posted on March 29, 2018
If you have custom component named "doWhateverScreen" and you would like to print a string passed down from a different component named "HomeScene" using function in "doWhateverScreen" component interface, this is how you would do it.
First in your doWhateverScreen.xml file add:
<interface>
<function name="doWhateverMan" />
</interface>
Now in doWhateverScreen.brs file add your "doWhateverMan" function:
Function doWhateverMan(param as String)
print param
End Function
Great, so far so good!Let us continue.
In your HomeScene.xml add this custom created "doWhateverScreen" screen/component and in HomeScene.brs init() function add:
m.doWhateverScreen= m.top.findNode("doWhateverScreen")
We can now call a function named "doWhateverMan" from HomeScene.brs with:
param = "Do Androids Dream of Electric Sheep?"
m.doWhateverScreen.callFunc("doWhateverMan",param)
That's it! Have a great day. :-D
💖 💪 🙅 🚩
Uros Mitic
Posted on March 29, 2018
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
brightscript How to define a function in component interface on Roku(BrightScript/SceneGraph)
March 29, 2018