Underline text in Flash

How do I add an underline to text in Flash?

I’m creating a simple text button and want the over state to be underlined.

I don’t really want to have to go in and draw an underline. Should I perhaps do add it in Photoshop and then import it to the button over state? Is this even possible?

Your text field should be dynamic and not static for this to work. Assuming the text field has an instance name of “mytext” you would do this:

var myformat:TextFormat = new TextFormat();
myformat.underline = true;


Will that work in AS3.0 as well as AS2.0?

Well, you have to say, it’s quite easy to test and answer your own question but yes it works with AS3 and AS2.

Ah yes I should have thought of that myself. Thank you anyway.