# LoadText Class

**URL:** <https://forum.kirupa.com/t/loadtext-class/306511>\
**Category:** flash\
**Created:** [March 16, 2010, 8:36pm UTC](https://forum.kirupa.com/t/loadtext-class/306511 "2010-03-16T20:36:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)\
**Post date:** [March 16, 2010, 8:36pm UTC](https://forum.kirupa.com/t/loadtext-class/306511/1 "2010-03-16T20:36:29Z")

</div>

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.

```auto
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

```auto
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

```auto
tgt.text = e.target.data;

```

to put it in.

Any ideas?  
Thanks
