forked from as3/as3-utils
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcreateField.as
More file actions
29 lines (28 loc) · 900 Bytes
/
createField.as
File metadata and controls
29 lines (28 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package utils.textField
{
import flash.text.StyleSheet;
import flash.text.TextField;
import flash.text.TextFormat;
/**
* Create a <code>TextField</code> instance and return it.
*/
public function createField(str:String, x:Number = 0, y:Number = 0, width:Number = 200, height:Number = 20, multiline:Boolean = false, font:String = "Verdana", size:Number = 9, color:uint = 0,
autoSize:String = 'left', embedFonts:Boolean = false, selectable:Boolean = false, css:StyleSheet = null):TextField
{
var tf:TextField = new TextField();
var fmt:TextFormat = new TextFormat(font, size, color);
tf.x = x;
tf.y = y;
tf.width = width;
tf.height = height;
tf.autoSize = autoSize;
tf.embedFonts = embedFonts;
tf.selectable = selectable;
tf.multiline = multiline;
tf.textColor = color;
tf.defaultTextFormat = fmt;
tf.htmlText = str;
tf.styleSheet = css;
return tf;
}
}