class TextInput
package feathers.controls
extends FeathersControl › MeasureSprite › ValidatingSprite
implements ITextControl, IStateContext<TextInputState>
A text entry control that allows users to enter and edit a single line of uniformly-formatted text.
The following example sets the text in a text input, selects the text, and listens for when the text value changes:
var input = new TextInput();
input.text = "Hello World";
input.selectRange(0, input.text.length);
input.addEventListener(Event.CHANGE, input_changeHandler);
this.addChild(input);
1.0.0
.See:
Constructor
Variables
backgroundSkin:DisplayObject = null
The default background skin for the text input, which is used when no
other skin is defined for the current state with setSkinForState()
.
The following example passes a bitmap for the text input to use as a background skin:
input.backgroundSkin = new Bitmap(bitmapData);
1.0.0
.See:
read onlycurrentState:TextInputState = ENABLED
The current state of the text input.
1.0.0
.See:
paddingBottom:Float = 0.0
The minimum space, in pixels, between the text input's bottom edge and the text input's content.
In the following example, the text input's bottom padding is set to 20 pixels:
input.paddingBottom = 20.0;
1.0.0
.paddingLeft:Float = 0.0
The minimum space, in pixels, between the text input's left edge and the text input's content.
In the following example, the text input's left padding is set to 20 pixels:
input.paddingLeft = 20.0;
1.0.0
.paddingRight:Float = 0.0
The minimum space, in pixels, between the text input's right edge and the text input's content.
In the following example, the text input's right padding is set to 20 pixels:
input.paddingRight = 20.0;
1.0.0
.paddingTop:Float = 0.0
The minimum space, in pixels, between the text input's top edge and the text input's content.
In the following example, the text input's top padding is set to 20 pixels:
input.paddingTop = 20.0;
1.0.0
.restrict:String
Limits the set of characters that may be typed into the TextInput
.
In the following example, the text input's allowed characters are restricted:
input.restrict = "0-9";
1.0.0
.See:
scrollX:Float = 0.0
The horizontal scroll position (on the x-axis) of the text, measured in pixels.
The following example changes the text input's scroll position:
input.scrollX = 20.0;
1.0.0
.text:String = ""
The text displayed by the text input.
The following example sets the text input's text:
input.text = "Good afternoon!";
1.0.0
.See:
input.textFormat
textFormat:TextFormat = null
The font styles used to render the text input's text.
In the following example, the text input's formatting is customized:
input.textFormat = new TextFormat("Helvetica", 20, 0xcc0000);
1.0.0
.See:
verticalAlign:VerticalAlign = MIDDLE
How the content is positioned vertically (along the y-axis) within the text input.
The following example aligns the text input's content to the top:
input.verticalAlign = TOP;
See:
Methods
getSkinForState (state:TextInputState):DisplayObject
Gets the skin to be used by the text input when its currentState
property matches the specified state value.
If a skin is not defined for a specific state, returns null
.
1.0.0
.See:
getTextFormatForState (state:TextInputState):TextFormat
Gets the text format to be used by the text input when its currentState
property matches the specified state value.
If a text format is not defined for a specific state, returns null
.
1.0.0
.See:
setSkinForState (state:TextInputState, skin:DisplayObject):Void
Set the skin to be used by the text input when its currentState
property matches the specified state value.
If a skin is not defined for a specific state, the value of the
backgroundSkin
property will be used instead.
1.0.0
.See:
setTextFormatForState (state:TextInputState, textFormat:TextFormat):Void
Set the text format to be used by the text input when its currentState
property matches the specified state value.
If a text format is not defined for a specific state, the value of the
textFormat
property will be used instead.
1.0.0
.See: