I have a textfield on the stage, and I have made a class to load in some text into it.
I just cannot get it to work :: would someone look at my code and see whats up.
package
{
import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
public class LoadText extends Sprite
{
private var txtLoader:Loader;
private var tgt:MovieClip;
public function LoadText(url:String,a:MovieClip):void
{
txtLoader = new Loader();
txtLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,addText);
txtLoader.load(new URLRequest(url));
tgt = a;
}
private function addText(e:Event):void
{
trace(e.target.data);
}
}
}
in my main timeline I write the following to access the class
var txt:LoadText = new LoadText("myText.txt, bio.area_txt);
All in all - it should be simple stuff :: but I cant see why my trace doesnt work. let alone type
tgt.text = e.target.data;
to put it in.
Any ideas?
Thanks