Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

If the <script/> element contains the definition of a function named init() that has no parameters TBD what if it has parameters? TBD, 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 TBD among other things TBD.

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.

Using the init() Function in XML
  • No labels