![]() ![]() | |
Flash Player 6。
my_mc.createTextField(instanceName, depth, x, y, width, height)
instanceName 一个字符串,指示新文本字段的实例名称。
depth 一个正整数,指定新文本字段的深度。
x 一个整数,指定新文本字段的 x 坐标。
y 一个整数,指定新文本字段的 y 坐标。
width 一个正整数,指定新文本字段的宽度。
height 一个正整数,指定新文本字段的高度。
无。
方法;创建一个新的、空文本字段作为由 my_mc 指定的影片剪辑的子级。可以使用 createTextField() 在 SWF 文件播放时创建文本字段。文本字段位于 (x, y),尺寸为 width 乘 height。参数 x 和 y 都相对于容器影片剪辑;这些参数与文本字段的 _x 和 _y 属性相对应。参数 width 和 height 与文本字段的 _width 和 _height 属性相对应。
文本字段的默认属性如下所示:
type = "dynamic" border = false background = false password = false multiline = false html = false embedFonts = false variable = null maxChars = null
用 createTextField() 创建的文本字段可以接收下列默认 TextFormat 对象:
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)
下面的示例创建一个宽 300,高 100 的文本字段,其 x 坐标为 100,y 坐标为 100,该文本字段没有边框,文本为红色并带下划线。
_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);
![]() ![]() | |