-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMTTextField.as
More file actions
42 lines (35 loc) · 1.01 KB
/
MTTextField.as
File metadata and controls
42 lines (35 loc) · 1.01 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
package
{
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
public class MTTextField extends TextField
{
private var myFormat:TextFormat ;
public function MTTextField(color:uint=0,size:Number=20,Font:String = "B Yekan Regular",align:String = TextFormatAlign.CENTER , lineSpacing:Number = 0 )
{
super();
//1 generate required textFormat
myFormat = this.getTextFormat() ;
myFormat.size = size ;
myFormat.font = Font ;
myFormat.align = align ;
myFormat.leading = lineSpacing ;
this.textColor = color ;
//2 set sample text to set format
this.text = '1234' ;
//3 set text format in two ways
this.setTextFormat(myFormat) ;
this.defaultTextFormat = myFormat ;
//4 initialize the textField
this.embedFonts = true ;
this.selectable = false;
this.multiline = false ;
this.wordWrap = false ;
//5 set textField height
this.height = this.textHeight ;
//6 Clear the textField
this.text = '' ;
}
}
}