the following works outside of a class but I cant get the onLoad to fire another function inside the following class construct.
Code:
class Screen {
private var code:String;
private var type:String;
private var theme:String;
private var title:String;
private var xmlFile:String;
private var dataXML:XML;
//--------------------------------------------------------------
public function Screen(code) {
this.code = code;
//trace("extended with CurrentPage");
//trace("need to load the particular xml file here "+code+".xml");
this.loadXML();
}
private function loadXML() {
dataXML = new XML();
dataXML.load("content/xml/"+this.code+".xml");
dataXML.onLoad = function() {
trace("loaded xml");
this.toVars("test");
// the XML is loaded so strip out the whitespace
dataXML.ignoreWhite = true;
// turn the XML doc content into flash variables
};
}/**/
private function toVars(a){
trace(">>"+a);
//parse through the document and put our page into manageable object or arrays ?
//how best to do this?
//this is the parent class so is dealing only with screen based content.
}
}
toVars will not fire, despite the onLoad firing as it traces ok. I give the xml here
Code:
<menuroot>
<node item="code" value="000000" />
<node label="type" pos="contentTitle" />
<node label="theme" pos="turqoiseBay" />
<node label="content">
<node item="title" value="<![CDATA[DISK OVERVIEW]]>" />
<node label="graphic" pos="00000000.swf" />
</node>
</menuroot>