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: 
Highlighted
Taurian
Level 7

Calling a function from main.brs

Hi, I have a dumb question. I'm trying to call a function from main.brs, getting the usual error about it unable to see it.


//main.brs
scene = screen.CreateScene("HomeScene") //Function is located in the "HomeScene.brs, not the .xml"
scene.myfunction() <-- Error


Thanks,

-T
0 Kudos
2 Replies
joetesta
Level 10

Re: Calling a function from main.brs

did you try this?
https://sdkdocs.roku.com/display/sdkdoc/interface

Add to your HomeScene xml:
<interface>
   <function name="myfunction" />
</interface>


Does it work from scene?
aspiring
0 Kudos
Taurian
Level 7

Re: Calling a function from main.brs

No, but that did lead me to this:
https://sdkdocs.roku.com/display/sdkdoc ... onalFields

and this:
scene.callFunc("myfunction")

Thanks.
0 Kudos