# Adding button with dynamic text fields

**URL:** <https://forum.kirupa.com/t/adding-button-with-dynamic-text-fields/320079>\
**Category:** flash\
**Created:** [March 13, 2011, 6:59pm UTC](https://forum.kirupa.com/t/adding-button-with-dynamic-text-fields/320079 "2011-03-13T18:59:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttmt](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@ttmt](https://forum.kirupa.com/u/ttmt)\
**Post date:** [March 13, 2011, 6:59pm UTC](https://forum.kirupa.com/t/adding-button-with-dynamic-text-fields/320079/1 "2011-03-13T18:59:39Z")

</div>

Adding button with dynamic text fields

Hi all

I haven’t used flash for a while so I’m a bit rusty.

I’m simple trying to add a Button with a dynamic text field and a over state to the button that changes the color of the text.

I want to create a list of nav links and then have an over state on the links.

I tried this, but I’m getting lost.

I have a button in the library with an over state and a text field. The button is exported for Actionscript.

```auto

package{
	
	import flash.display.*;
	import flash.events.*;
	import flash.text.*;
	
	public class Doc extends MovieClip{
		
		private var btn:SimpleButton = new But()
		private var txt:TextField = new TextField()
		
		public function Doc(){
			txt.text = "New text";
			txt.x = 0;
			txt.y = 0;
			addChild(btn);
			btn.addChild(txt);
			btn.x=btn.y=100;
		}
	}	
}

```
