# Change texfield color with button?

**URL:** <https://forum.kirupa.com/t/change-texfield-color-with-button/253654>\
**Category:** Uncategorized\
**Created:** [March 3, 2008, 9:41pm UTC](https://forum.kirupa.com/t/change-texfield-color-with-button/253654 "2008-03-03T21:41:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrickjv](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@patrickjv](https://forum.kirupa.com/u/patrickjv)\
**Post date:** [March 3, 2008, 9:41pm UTC](https://forum.kirupa.com/t/change-texfield-color-with-button/253654/1 "2008-03-03T21:41:44Z")

</div>

Is there a way to “extract/trace()” the color of a dynamically generated texfield? Then use a button to change text color on mouse over and return original on mouse out?

```auto
 
var textvalue:TextField = new TextField();;
var format:TextFormat = new TextFormat();
var colorinmemory:int;
var colorArray:Array = new Array(0xFF0000,0x00FF00,0x0000FF);
 
format.color = colorArray[Math.floor(Math.random()*colorArray.length)];
textvalue.defaultTextFormat = format;
 
addChild(textvalue);
textvalue.text = "hello world";
 
function mouseOverA (event:MouseEvent):void{
 //colorinmemory = textvalue.color; // won't work
 trace(colorinmemory);
// some way to set text to black
}
a_btn.addEventListener (MouseEvent.MOUSE_OVER, mouseOverA);
 
function mouseOutA (event:MouseEvent):void{
 
 // some way to re-set text to color
}
a_btn.addEventListener (MouseEvent.MOUSE_OUT, mouseOutA);

```

looking for some way to fill in the comment lines. Seems so simple but nothing I try works  
anyone?  
P
