# addChild(problem);

**URL:** https://forum.kirupa.com/t/addchild-problem/296163
**Category:** flash
**Created:** [September 10, 2009, 9:27am UTC](https://forum.kirupa.com/t/addchild-problem/296163 "2009-09-10T09:27:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![burger](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@burger](https://forum.kirupa.com/u/burger)
#### Post date: [September 10, 2009, 9:27am UTC](https://forum.kirupa.com/t/addchild-problem/296163/1 "2009-09-10T09:27:59Z")

</div>

sorry, new to the AS3 thing, what am I doing wrong? the text field wont follow the movie?

```php

package com.equ.Interface{
	import flash.display.Sprite;
	import flash.display.MovieClip;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.events.*;

	public class Tabs extends MovieClip {

		public function Tabs() {

			var tabs=new Array ;
			tabs.push("1. Body");
			tabs.push("2. Face");
			tabs.push("3. Hair");
			tabs.forEach(drawTab);
			
		}

		private function drawTab(element:String,index:int,array:Array):void {
			var tab:MovieClip=new MovieClip;
			tab.graphics.beginFill(0xFCD323);
			tab.graphics.drawRoundRect(index*144,0,143,40,0,0);
			tab.graphics.endFill();
			tab.buttonMode=true;
			tab.addEventListener(MouseEvent.CLICK,onClick);
			addChild(tab);

			var textLabel:TextField=new TextField ;
			var format:TextFormat=new TextFormat ;
			format.font="Arial";
			format.size=13;
			textLabel.text=element;
			textLabel.x=6;
			textLabel.y=16;
			textLabel.selectable=false;
			textLabel.setTextFormat(format);
			tab.addChild(textLabel);

		}

		private function onClick(evt:MouseEvent):void {
			trace("click");
		}
	}
}

```
