# addChild from an external .as file

**URL:** <https://forum.kirupa.com/t/addchild-from-an-external-as-file/281946>\
**Category:** flash\
**Created:** [February 15, 2009, 11:54pm UTC](https://forum.kirupa.com/t/addchild-from-an-external-as-file/281946 "2009-02-15T23:54:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevin416](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@kevin416](https://forum.kirupa.com/u/kevin416)\
**Post date:** [February 15, 2009, 11:54pm UTC](https://forum.kirupa.com/t/addchild-from-an-external-as-file/281946/1 "2009-02-15T23:54:15Z")

</div>

Hello Everyone,  
I was trying to add a TextField to the stage from an external class. I’ve made a small example of the part that isn’t working for me.

The basic idea of the external class:

```auto
package {
	import flash.display.Sprite;
	import flash.text.TextField;
	public class Text extends Sprite {
		public function Text():void {
			var txt:TextField = new TextField();
			txt.x = 0;
			txt.y = 0;
			txt.text = "this is a text test" ;
			addChild( txt );
		}
	}
}

```

The timeline code:

```auto
import Text;
var a:Text = new Text();

```

When I run this I don’t get any errors, but the text still doesn’t show on the stage.  
Thanks for any help.
