I have set up two classes, one is the DocumentClass and it imports a custom class i have made called XMLLoader. The problem is I want to change the value of a dynamic text field on the stage with the instance name xml_txt from within the XMLLoader class…
package classes
{
import flash.display.MovieClip;
import classes.XMLLoader;
public class DocumentClass extends MovieClip
{
public function DocumentClass():void
{
var xml:XMLLoader = new XMLLoader();
}
}
}
package classes
{
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class XMLLoader
{
var req:URLRequest = new URLRequest("myXML.xml");
var loader:URLLoader = new URLLoader();
public function XMLLoader():void
{
loader.addEventListener(ProgressEvent.PROGRESS, loadProgress);
loader.addEventListener(Event.COMPLETE, loadComplete);
loader.load(req);
}
private function loadProgress(event:ProgressEvent):void
{
var percent:Number = ( 100 / event.bytesTotal ) * event.bytesLoaded;
trace(Math.round(percent));
}
private function loadComplete(event:Event):void
{
var newLoader:URLLoader = URLLoader(event.target);
trace(newLoader.data);
}
}
}