IntegerInput

An integer number input field with an optional label and optional auto-repeating stepper buttons.  The data entry area is indicated with a stippled line.

See also

NumberInput, StringInput.

Summary
IntegerInputAn integer number input field with an optional label and optional auto-repeating stepper buttons.
public static constants
DEFAULT_LABEL_WIDTHDefault width of the optional label in pixels
DEFAULT_INPUT_WIDTHDefault width of the numeric input field in pixels
defaultColorDefault color of the text in the field and the label
defaultFontSizeA medium default size for the font.
defaultStepperSizeStepper size, each stepper is square
Private data members
inputInternal text field used to display and edit the data.
plusButtonSmall stepper/spin button for incrementing the value in the field.
minusButtonSmall stepper/spin button for decrementing the value in the field.
callbackCallback function called when the field has been changed.
stepColorBase theme color of the stepper buttons
Public properties
stepStep size used when incrementing/decrementing
minimumThe smallest value that the field will be decremented to.
maximumThe largest value that the field will be incremented to.
Constructor
IntegerInputCreates an integer number input field with an optional label and optional auto-repeating stepper buttons.
Public properties
valueGet the integer value from the field.
valueChange the field to a new integer value.
Event handlers
incrementIncrements the field value when the user clicks or auto-repeats the up stepper button by keeping it pressed.
decrementDecrements the field value when the user clicks or auto-repeats the down stepper button by keeping it pressed.
inputChangeHandlerTriggers a set change callback when the 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 numeric input 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.

defaultStepperSize

public static const defaultStepperSize: int

Stepper size, each stepper is square

Private data members

input

private var input: TextField

Internal text field used to display and edit the data.

plusButton

private var plusButton: ShapeButton

Small stepper/spin button for incrementing the value in the field.

minusButton

private var minusButton: ShapeButton

Small stepper/spin button for decrementing the value in the field.

callback

private var callback: Function

Callback function called when the field has been changed.

stepColor

private var stepColor: uint

Base theme color of the stepper buttons

Public properties

step

public var step: Number

Step size used when incrementing/decrementing

minimum

public var minimum: Number

The smallest value that the field will be decremented to.  Note that the user can type in smaller values since data validation is not performed on text entry.

maximum

public var maximum: Number

The largest value that the field will be incremented to.  Note that the user can type in larger values since data validation is not performed on text entry.

Constructor

IntegerInput

public function IntegerInput(owner: String,  
labelText: String = null,
inputValue: int = 0,
changeHandler: Function = null,
useStepper: Boolean = true,
stepperColor: uint = Color.Grey,
labelWidth: uint = DEFAULT_LABEL_WIDTH,
inputWidth: uint = DEFAULT_INPUT_WIDTH,
color: uint = defaultColor,
fontSize: uint = defaultFontSize)

Creates an integer number input field with an optional label and optional auto-repeating stepper buttons.

Parameters

ownername of registered owner; see WidgetSprite.register
labelTexttext to use as a label for the field (default null for no label)
inputValueinitial integer value (default 0)
changeHandlerfunction called when the field value changes (default null)
useStepperdisplays an up/down stepper if true (default true)
stepperColorbase theme color for the number stepper (default Grey)
labelWidthwidth of the label (default 80 pixels)
inputWidthwidth of the field (default 70 pixels)
colorbase theme color for the field font and label (default MediumGrey)
fontSizesize of the font used (default 10)

Callbacks

changeHandlerfunction onIntegerInputChange(value:int):void

Public properties

value

public function get value():int

Get the integer value from the field.

Returns

Current field value as an integer

value

public function set value(integer: int):void

Change the field to a new integer value.  Triggers a change callback if one is set.

Parameters

integernew integer value

Event handlers

increment

private function increment():void

Increments the field value when the user clicks or auto-repeats the up stepper button by keeping it pressed.  The value is incremented by the step value set for the field up to the set maximum value.

decrement

private function decrement():void

Decrements the field value when the user clicks or auto-repeats the down stepper button by keeping it pressed.  The value is decremented by the step value set for the field down to the set minimum value.

inputChangeHandler

private function inputChangeHandler(event: Event):void

Triggers a set change callback when 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 numeric input 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.
public static const defaultStepperSize: int
Stepper size, each stepper is square
private var input: TextField
Internal text field used to display and edit the data.
private var plusButton: ShapeButton
Small stepper/spin button for incrementing the value in the field.
private var minusButton: ShapeButton
Small stepper/spin button for decrementing the value in the field.
private var callback: Function
Callback function called when the field has been changed.
private var stepColor: uint
Base theme color of the stepper buttons
public var step: Number
Step size used when incrementing/decrementing
public var minimum: Number
The smallest value that the field will be decremented to.
public var maximum: Number
The largest value that the field will be incremented to.
public function IntegerInput(owner: String,  
labelText: String = null,
inputValue: int = 0,
changeHandler: Function = null,
useStepper: Boolean = true,
stepperColor: uint = Color.Grey,
labelWidth: uint = DEFAULT_LABEL_WIDTH,
inputWidth: uint = DEFAULT_INPUT_WIDTH,
color: uint = defaultColor,
fontSize: uint = defaultFontSize)
Creates an integer number input field with an optional label and optional auto-repeating stepper buttons.
public function get value():int
Get the integer value from the field.
private function increment():void
Increments the field value when the user clicks or auto-repeats the up stepper button by keeping it pressed.
private function decrement():void
Decrements the field value when the user clicks or auto-repeats the down stepper button by keeping it pressed.
private function inputChangeHandler(event: Event):void
Triggers a set change callback when 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
A floating point number input field with an optional label and optional auto-repeating stepper buttons.
A one line text input field with an optional label.
public function register(owner: String):void
Register the owner of a widget.
Close