Beta - The contents of this page are subject to change
Allows initialization and other scripted control of a Scene Graph XML component.
If the <script> element contains the definition of a function named
init() that has no parameters, that function will be invoked after the XML file has been parsed and the nodes contained in the file have been created and had their fields set to the values in the XML. Typical uses of the
init() function are to cache roSGNode values in the script's global variable that will be frequently used in other functions in the script, and to set up field observers that will call other BrightScript functions when the observed field changes value.
If the XML file contains a Poster node element with
id="MyPoster", the XML file below will be parsed, creating the Poster node, then the
init() function will be called to cache a pointer to that node, set up an observer of the Poster node translation field, and print the value of the Poster node translation field in the console whenever it changes.