How to format static text in actionscript 3.0

61 views Asked by At
import flash.events.MouseEvent;
import flash.text.TextFormat;

myText.buttonMode = true;

var myFormat:TextFormat = new TextFormat;
myFormat.size = 24;

myText.setTextFormat(myFormat);

Here myText is the instance name of the MovieClip of static text. How do I format static text in Flash CS6?

1

There are 1 answers

0
null On

setTextFormat() is a method of the TextField class, not of the MovieClip class. You should call that method on a TextField, possibly the one in that MovieClip, that you named myText.

If you are wondering why you do not receive an error for calling a method that doesn't exist on your MovieClip: This is because MovieClip is a dynamic class.