![]() ![]() | |
Flash Player 6.
my_mc.createTextField(instanceName, depth, x, y, width, height)
instanceName A string that identifies the instance name of the new text field.
depth A positive integer that specifies the depth of the new text field.
x An integer that specifies the x coordinate of the new text field.
y An integer that specifies the y coordinate of the new text field.
width A positive integer that specifies the width of the new text field.
height A positive integer that specifies the height of the new text field.
Nothing.
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)
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);
![]() ![]() | |