MovieClip.createTextField() 495
Description
Method; creates a new, empty text field as a child of the movie clip specified by my_mc. You can
use
createTextField() to create text fields while a SWF file plays. The text field is positioned at
(
x, y) with dimensions width by height. The x and y parameters are relative to the container
movie clip; these parameters correspond to the
_x and _y properties of the text field. The width
and
height parameters correspond to the _width and _height properties of the text field.
The default properties of a text field are as follows:
type = "dynamic"
border = false
background = false
password = false
multiline = false
html = false
embedFonts = false
variable = null
maxChars = null
A text field created with createTextField() receives the following default TextFormat object:
font = "Times New Roman"
size = 12
textColor = 0x000000
bold = false
italic = false
underline = false
url = ""
target = ""
align = "left"
leftMargin = 0
rightMargin = 0
indent = 0
leading = 0
bullet = false
tabStops = [] (empty array)
Example
The following example creates a text field with a width of 300, a height of 100, an x coordinate of
100, a y coordinate of 100, no border, red, and underlined text.
_root.createTextField("mytext",1,100,100,300,100);
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = false;
myformat = new TextFormat();
myformat.color = 0xff0000;
myformat.bullet = false;
myformat.underline = true;
mytext.text = "this is my first test field object text";
mytext.setTextFormat(myformat);
See also
TextFormat class