StringInput

A one line text input field with an optional label.  The data entry area is indicated with a stippled line.

See also

IntegerInput, NumberInput.

Summary
StringInputA one line text input field with an optional label.
public static constants
DEFAULT_LABEL_WIDTHDefault width of the optional label in pixels
DEFAULT_INPUT_WIDTHDefault width of the input text field in pixels
defaultColorDefault color of the text in the field and the label
defaultFontSizeA medium default size for the font.
Private data members
inputInternal text field used to display and edit the data.
callbackCallback function called when the text in the field has been changed or when the refresh method is called.
Constructor
StringInputCreates a one line input text field with an optional label.
Public properties
textReturns the text string in the field.
textChanges the text displayed in the field.
Public methods
refreshActivates the change callback associated with the field if one has been set.
Event handlers
inputChangeHandlerThe text in the input field has been changed.
WidgetInterface
activeSets the state of the widget to active or inactive.
activateActivates the widget, adds its event listeners
disactivateDisactivates the widget, removes its event listeners
disposeDispose of all resources used or referenced in the instance.
destructorRemoves used resources, references and graphics

public static constants

DEFAULT_LABEL_WIDTH

public static const DEFAULT_LABEL_WIDTH: uint

Default width of the optional label in pixels

DEFAULT_INPUT_WIDTH

public static const DEFAULT_INPUT_WIDTH: uint

Default width of the input text field in pixels

defaultColor

public static const defaultColor: int

Default color of the text in the field and the label

defaultFontSize

public static const defaultFontSize: int

A medium default size for the font.

Private data members

input

private var input: TextField

Internal text field used to display and edit the data.

callback

private var callback: Function

Callback function called when the text in the field has been changed or when the refresh method is called.

Constructor

StringInput

public function StringInput(owner: String,  
labelText: String = null,
inputText: String = "",
changeHandler: Function = null,
labelWidth: uint = DEFAULT_LABEL_WIDTH,
inputWidth: uint = DEFAULT_INPUT_WIDTH,
color: uint = defaultColor,
fontSize: uint = defaultFontSize)

Creates a one line input text field with an optional label.

Parameters

ownername of registered owner; see WidgetSprite.register
labelTexttext to use as a label for the field (default null for no label)
inputTextinitial text displayed in the field (default “” for empty)
changeHandlercallback to be activated on changes and refresh (default null)
labelWidthwidth of the label (default 80 pixels)
inputWidthwidth of the field (default 70 pixels)
colorbase theme color for the field text and label (default MediumGrey)
fontSizesize of the font used (default 10)

Callbacks

changeHandlerfunction onStringInputChange(text:String):void

Public properties

text

public function get text():String

Returns the text string in the field.

text

public function set text(value: String):void

Changes the text displayed in the field.

Parameters

valuenew text to display

Public methods

refresh

public function refresh():void

Activates the change callback associated with the field if one has been set.  Typically to trigger actions perform in the callback that depends on the value in the text field.

Event handlers

inputChangeHandler

private function inputChangeHandler(event: Event):void

The text in the input field has been changed.

Parameters

eventan Event.CHANGE event

WidgetInterface

active

public function set active(state: Boolean):void

Sets the state of the widget to active or inactive.

Parameters

stateTrue to activate, false otherwise.

activate

private function activate():void

Activates the widget, adds its event listeners

disactivate

private function disactivate():void

Disactivates the widget, removes its event listeners

dispose

public function dispose():void

Dispose of all resources used or referenced in the instance.

destructor

private function destructor():void

Removes used resources, references and graphics

Widgets are required to implement this interface.
Base class for widgets to enable/disable event listeners and keep a global tab order of all widgets (provided they are created and registered in tab order.
public static const DEFAULT_LABEL_WIDTH: uint
Default width of the optional label in pixels
public static const DEFAULT_INPUT_WIDTH: uint
Default width of the input text field in pixels
public static const defaultColor: int
Default color of the text in the field and the label
public static const defaultFontSize: int
A medium default size for the font.
private var input: TextField
Internal text field used to display and edit the data.
private var callback: Function
Callback function called when the text in the field has been changed or when the refresh method is called.
public function refresh():void
Activates the change callback associated with the field if one has been set.
public function StringInput(owner: String,  
labelText: String = null,
inputText: String = "",
changeHandler: Function = null,
labelWidth: uint = DEFAULT_LABEL_WIDTH,
inputWidth: uint = DEFAULT_INPUT_WIDTH,
color: uint = defaultColor,
fontSize: uint = defaultFontSize)
Creates a one line input text field with an optional label.
public function get text():String
Returns the text string in the field.
private function inputChangeHandler(event: Event):void
The text in the input field has been changed.
public function set active(state: Boolean):void
Sets the state of the widget to active or inactive.
private function activate():void
Activates the widget, adds its event listeners
private function disactivate():void
Disactivates the widget, removes its event listeners
public function dispose():void
Dispose of all resources used or referenced in the instance.
private function destructor():void
Removes used resources, references and graphics
An integer number input field with an optional label and optional auto-repeating stepper buttons.
A floating point number input field with an optional label and optional auto-repeating stepper buttons.
public function register(owner: String):void
Register the owner of a widget.
Close