hello everybody
my problem is realy annoying, i wrote a script and it runs good in the general script of my fla file but now , i wrote a class with this algorythm but the array i need is empty...
..here is the script
PHP Code:
package
{
import flash.display.Stage;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
public class xmlReader
{
public function xmlReader(FilePath:String)
{
xmlLDR = new URLLoader();
xmlREQ = new URLRequest(FilePath);
xmlArray = new Array();
getFile(xmlLDR, xmlREQ);
}//
private var xmlLDR:URLLoader;
private var xmlREQ:URLRequest;
public var xmlArray:Array; //<<< i need this array as a result of this class
private function getFile(LDR:URLLoader, REQ:URLRequest):void
{
LDR.addEventListener(Event.COMPLETE, xmlLOADED);
LDR.load(REQ);
}//getFile
private function xmlLOADED(event:Event):void
{
var hxmlFile:XML = new XML();
hxmlFile = XML(event.target.data);
readXML(hxmlFile);
//trace(xmlFile); << xml file is loaded without errors
}//xmlLOADED
private function readXML(ixmlFile:XML):void
{
var hxmlFile:XML = ixmlFile;
for(var i:Number = 0; i < hxmlFile.child("values").length(); i++)
{
xmlArray.push([i, hxmlFile.values[i].cname.text(),
hxmlFile.values[i].path.text(),
hxmlFile.values[i].desc.text() ]);
}//for
//trace(xmlArray); //<<<and the array is filled with the entrys of the xml entrys
}//readXML
}//public class xmlReader
}//package
PHP Code:
var xmlFILE:xmlReader = new xmlReader("xml/gallery.xml");
trace(xmlFILE.xmlArray); //<<< i get no errors or something, he just empty _:confused:
puuh! does anyone have an idea whats going wrong, whats the major differences between the classes and the normal script in flash?
thanks for any advice or hints .. bye
Bookmarks