I’m creating a system that needs to access an XML feed. The code is currently in a class and looks like this:
import ArrayList;
class parser {
private var XMLhandler:XML;
private var url:String;
private var PlayList;
function parser( theurl:String ) {
url = theurl;
XMLhandler = new XML();
XMLhandler.ignoreWhite = true;
XMLhandler.onData = XMLloaded;
PlayList = new ArrayList();
//PlayList.addTo( new Image( 'weee' ) );
}
public function test(){
trace('test');
}
public function XMLloaded( feed ){
trace('wtf');
test();
PlayList.addTo( new Image( 'weee' ) );
}
public function loadXML( ){
XMLhandler.load( url );
}
}
The result i would expect from running this code is:
wtf
test
however the test() method does not seem to get called. The end goal of this code is to store bits of XML into the PlayList, which is not accessible in the XMLloaded function despite being a class variable.
Whats going on here?
Many thanks