jaxim
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2016
12:03 PM
Referencing a function from a brs file from another brs file?
What is the best way for one BRS file (that does not have an associated XML file) to reference a function within another BRS file (that does have an associated XML file)?
6 REPLIES 6
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2016
12:25 PM
Re: Referencing a function from a brs file from another brs file?
There is no "best way". It either works or it doesn't 🙂
Be more specific!
The typical Brightscript behavior is that all files in /source are included automatically and visible (i.e. the main thread).
In XMLophony though, only the explicitly <script> included sources are visible.
Be more specific!
The typical Brightscript behavior is that all files in /source are included automatically and visible (i.e. the main thread).
In XMLophony though, only the explicitly <script> included sources are visible.
jaxim
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2016
01:28 PM
Re: Referencing a function from a brs file from another brs file?
In A.brs file (located under the folder: "/components/screens/A), I have the following function:
In a different file (B.brs located under the folder "/source"), I try to make reference to the foo() method like so:
But this causes a runtime error.
What am I doing wrong? How do I ensure the B.brs file has a reference to the A.brs file.
Function foo()
? 'foo()$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'
end Function
In a different file (B.brs located under the folder "/source"), I try to make reference to the foo() method like so:
foo()
But this causes a runtime error.
What am I doing wrong? How do I ensure the B.brs file has a reference to the A.brs file.
softworkz
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2016
02:01 PM
Re: Referencing a function from a brs file from another brs file?
You need to put an additional <script> tag into your component xml file
jaxim
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2016
02:13 PM
Re: Referencing a function from a brs file from another brs file?
But I want to make a reference from B to A. B does not have a corresponding XML file.
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2016
04:08 PM
Re: Referencing a function from a brs file from another brs file?
"jaxim" wrote:
But I want to make a reference from B to A. B does not have a corresponding XML file.
Who is executing or including the B file?
If the functions in B.brs are executed as part of main() thread, so should A.brs file be part of /source.
Yes, the mating between RSG and Brightscript has been grossly mismanaged (or "fork"ed up, if you will)... but we all knew that already.
KiranPrasanna
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023
02:59 AM
Re: Referencing a function from a brs file from another brs file?
I have two brs files i.e task.brs and grid.brs
I have set the variable value in task.brs file. I need to access this variabel value in grid.brs file . But I don't know how access that value. Could you provide the information