3 Replies Latest reply on Dec 29, 2008 11:38 AM by kglad

    XML onLoad function -- pass XML nodes to global variables

      I am an intermediate Flash coder at best. I'm trying to understand why I can't access/update variables I define in the root of my Flash file within the XML onLoad function.

      The onLoad function looks like this:

      demoXML.onLoad = function() {
      demoTOC.dataProvider = this.firstChild;
      var theDemoList:XMLNode = this.firstChild;
      trace (theDemoList); // traces OK
      _root.theDemos = theDemoList;
      trace (_root.theDemos); //traces OK

      Outside this function, if I do a trace of the variable theDemos (defined in the root), then it's undefined.

      Seems to be some kind of scoping issue, but I can't seem to get around this. If anyone knows how to make this work, please let me know.