neowinston
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2017
07:19 AM
Why I can't access a function in another file?
I'm trying to access a function in another file, but I'm getting the error:
The function is located on the Main.brs. Even if the files are in the same folder I can't access the function. What is happening? How do I fix this? Thanks for your help!
Function Call Operator ( ) attempted on non-function. (runtime error &he0)
The function is located on the Main.brs. Even if the files are in the same folder I can't access the function. What is happening? How do I fix this? Thanks for your help!
3 REPLIES 3
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2017
04:15 PM
Re: Why I can't access a function in another file?
usually you would have the scripts in another file (although usually not Main, not sure how that would work out)
But yes, put your function in someOtherFile.brs then include that in your component's XML and then you'll have access to that function
But yes, put your function in someOtherFile.brs then include that in your component's XML and then you'll have access to that function
<script type="text/brightscript" uri="pkg:/components/someOtherFile.brs" />
aspiring
NB_
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2017
03:21 PM
Re: Why I can't access a function in another file?
Brightscript source files are handled differently between SDK1 and RSG apps. The main() function and friends from pkg:/source are automatically compiled together. For RSG XML components however, only the explicitly <script uri=...> included .brs files are read for that particular component.
neowinston
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017
07:44 AM
Re: Why I can't access a function in another file?
Thanks for the help Joe and RokuNB!