Forum Discussion
belltown
9 years agoRoku Guru
In Main(), you need to gain access to the Global Node, which is a global super-node that's global to everything in the entire Scene Graph Application (https://sdkdocs.roku.com/display/sdkdoc/Scene+Graph+Data+Scoping). You can call your Main's Global Node reference anything you like. Roku documentation uses "m.global" (which defines a property in the BrightScript global associative array -- which is only accessible from the Main thread). Personally, I just use a local variable called "g" in Main().
Then you need to create a field (or fields) in the Global Node for your config data:
Then you need to assign your config object to the config field you created in the Global Node:
In your Scene code, you can reference fields in the Global Node like so (Note that the use of "m.global" in a Scene, versus in Main(), is required; you can't call it something else):
screen = CreateObject("roSGScreen")
.
.
m.global = screen.getGlobalNode()
Then you need to create a field (or fields) in the Global Node for your config data:
m.global.addField("config", "assocarray", false)
Then you need to assign your config object to the config field you created in the Global Node:
m.global.config = getConfig()
In your Scene code, you can reference fields in the Global Node like so (Note that the use of "m.global" in a Scene, versus in Main(), is required; you can't call it something else):
print "global config: "; m.global.config