forked from as3/as3-utils
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTextFieldWrapper.as
More file actions
45 lines (42 loc) · 1.33 KB
/
TextFieldWrapper.as
File metadata and controls
45 lines (42 loc) · 1.33 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
43
44
45
package utils.textField
{
import flash.display.MovieClip;
import flash.text.TextField;
/**
* Because TextFields are not MovieClips, you cannot do timeline
* tweens on a TextField in Flash CSx without first making it a child
* of a MovieClip.
*
* This class acts as a base class for creating these types of movieclips
* so you don't need to create a new class for each text field that
* does this.
*
* In the flash library, create a new movieclip symbol containing the
* textField. Make sure you set the instance name for the text field to
* "textField". Make the base class for the symbol
* "util.textfield.TextFieldWrapper". Allow Flash to automatically
* generate the class for you.
* When referencing this MovieClip in your code, use the type
* AbstractTextFieldWrapper insatead of MovieClip. You will be able to set
* the text of the TextField using the .text property.
*
* @author Mims H. Wright
*/
public class TextFieldWrapper extends MovieClip
{
/**
* Direct reference to the text field.
*/
public var textField:TextField;
/** Passes the text through to the text field. */
public function set text(text:String):void {
textField.text = text;
}
public function get text():String {
return textField.text;
}
public function TextFieldWrapper() {
super();
}
}
}