Static class wrapping various Text utilities.
static public function create(scope:MovieClip, instanceName:String, x:Number, y:Number, w:Number, h:Number, props:Object, fprops:Object, css:String):TextField
createTextField wrapper
scope | (MovieClip) target movieclip scope |
instanceName | (String) created TextField instance name |
x | (Number) x pos |
y | (Number) y pos |
w | (Number) width |
props | (Object) object populated with extra props to apply to TextField |
fprops | (Object) object populated with TextFormat properties to apply to TextField |
css | (String) CSS Stylesheet to apply; may be either inline css or an external stylesheet url |
TextField
Usage: TextUtils.create(_root, "tf", 10, 10, 100, 20, {antiAliasType:"advanced", autoSize:true, embedFonts:false, html:true, htmlText:"hello world", multiline:true, mouseWheelEnabled:true, selectable:false, type:"dynamic", wordWrap:true}, {font:"Verdana",size:9,color:0x000000});
static public function format(tf:TextField, props:Object, css:String):Void
TextFormat wrapper
tf | (TextField) target TextField |
props | (Object) object populated with TextFormat props to apply to TextField |
Void
Usage: TextUtils.format(tf, {font:"Verdana",size:9,color:0x000000});
static public function style(tf:TextField, css:String):Void
TextField.StyleSheet wrapper
tf | (TextField) target TextField |
css | (String) CSS Stylesheet to apply; may be either inline css or an external stylesheet url |
Void
Usage: TextUtils.style(tf, "css/styles.css"); TextUtils.style(tf, "a:link{color:#c20b10; text-decoration:none; font-style:italic;} a:hover{color:#363636; text-decoration:underline; font-style:italic;}");
static public function focusToggle(tf:TextField):Void
empty a TextField.onSetFocus, restore to default if blank onKillFocus on input textfield
tf | (TextField) target TextField |
Void
Usage:
tf.onSetFocus = tf.onKillFocus = function ():Void { TextUtils.focusToggle (tf); };
static public function caret(tf:TextField, index:Number):Void
place cursor caret at index of text in textfield
tf | (TextField) target TextField |
index | (Number) character number to place caret |
Void
Usage:
TextUtils.caret (tf, 5);
static public function select(tf:TextField, sIndex:Number, eIndex:Number):Void
select an area of text with cursor within text
tf | (TextField) target TextField |
sIndex | (Number) start character index of selection |
eIndex | (Number) end character index of selection |
Void
Usage: TextUtils.select (tf, 5, 10);
static public function antiAlias(tf:TextField, thick:Number, sharp:Number, gridFitType:Number, isAdvanced:Boolean):Void
antiAlias settings for textfield
tf | (TextField) target TextField |
thick | (Number) set thickness of antialias [-200 to 200, default:0] |
sharp | (Number) set sharpness of antialias [-400 to 400, default:0] |
gridFitType | (Number) 0:["none"-for large fonts & anim] 1:["pixel"-for legibility of left-aligned text] 2:["subpixel"-for right-aligned or centered text] [default: 1] |
isAdvanced | (Boolean) type of antialias: should be true for anything <48pts [default: true] |
Void
Usage: TextUtils.antiAlias (tf, 200, -200, 1, true);
static public function excerpt(tf:TextField, n:Number, ellipseLine:Boolean):Void
ellipse text after the defined number of lines
tf | (TextField) target TextField |
n | (Number) number of lines of text desired |
ellipseLine | (Boolean) ellipse at exact end of line [true] or after the last full word [false] |
Void
static public function chop(tf:TextField, cutW:Number, ellipse:Boolean, longEllipse:Boolean):Void
chop single-line text to width, use optional ellipse
tf | (TextField) target text |
cutW | (Number) desired text width |
ellipse | (Boolean) add ... |
longEllipse | (Boolean) add ... to end of textField (currently not working) |
Void