# TextFormat Object

**URL:** <https://forum.kirupa.com/t/textformat-object/179373>\
**Category:** flash\
**Created:** [February 19, 2006, 1:59pm UTC](https://forum.kirupa.com/t/textformat-object/179373 "2006-02-19T13:59:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Terry\_elekes](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@Terry\_elekes](https://forum.kirupa.com/u/Terry_elekes)\
**Post date:** [February 19, 2006, 1:59pm UTC](https://forum.kirupa.com/t/textformat-object/179373/1 "2006-02-19T13:59:03Z")

</div>

I have a input text box that you type the answer into and hit a button that will check the anwser. If the answer is wrong the word wrong shows up in the text box. My question is how can I get the word “wrong” to show in red.  
Here is the code I am using also I have attached the file.  
submit\_btn.onRelease = function() {  
var W:Number = width\_txt.text;  
var H:Number = height\_txt.text;  
var A:Number = answer\_txt.text;  
if (A == (W_H)) {  
answer\_txt.text = W_H;  
} else {  
[COLOR=red]myFormat = new TextFormat();  
myFormat.color = 0xFF000;  
answer\_txt.text.setTextFormat(myFormat);[/COLOR]  
answer\_txt.text = “Wrong”;  
}  
};  
clear\_btn.onRelease = function() {  
width\_txt.text = “”;  
height\_txt.text = “”;  
answer\_txt.text = “”;  
};
