NumberInput |
A floating point number input field with an optional label and optional auto-repeating stepper buttons. The data entry area is indicated with a stippled line.
NumberInput | A floating point number input field with an optional label and optional auto-repeating stepper buttons. |
public static constants | |
DEFAULT_LABEL_WIDTH | Default width of the optional label in pixels |
DEFAULT_INPUT_WIDTH | Default width of the numeric input field in pixels |
defaultColor | Default color of the text in the field and the label |
defaultFontSize | A medium default size for the font. |
defaultStepperSize | Stepper size, each stepper is square |
Private data members | |
input | Internal text field used to display and edit the data. |
plusButton | Small stepper/spin button for incrementing the value in the field. |
minusButton | Small stepper/spin button for decrementing the value in the field. |
callback | Callback function called when the field has been changed. |
stepColor | Base theme color of the stepper buttons |
Public properties | |
precision | Number of fractional decimal digits shown |
step | Step size used when incrementing/decrementing |
minimum | The smallest value that the field will be decremented to. |
maximum | The largest value that the field will be incremented to. |
Constructor | |
NumberInput | Creates a floating point number input field with an optional label and optional auto-repeating stepper buttons. |
Public properties | |
value | Get the numeric value from the field. |
value | Change the field to a new numeric value. |
Event handlers | |
increment | Increments the field value when the user clicks or auto-repeats the up stepper button by keeping it pressed. |
decrement | Decrements the field value when the user clicks or auto-repeats the down stepper button by keeping it pressed. |
inputChangeHandler | Triggers a set change callback when the text in the input field has been changed. |
WidgetInterface | |
active | Sets the state of the widget to active or inactive. |
activate | Activates the widget, adds its event listeners |
disactivate | Disactivates the widget, removes its event listeners |
dispose | Dispose of all resources used or referenced in the instance. |
destructor | Removes used resources, references and graphics |
public function NumberInput( owner: String, labelText: String = null, inputValue: Number = 0.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 a floating point number input field with an optional label and optional auto-repeating stepper buttons.
owner | name of registered owner; see WidgetSprite.register |
labelText | text to use as a label for the field (default null for no label) |
inputValue | initial numeric value (default 0.0) |
changeHandler | function called when the field value changes (default null) |
useStepper | displays an up/down stepper if true (default true) |
stepperColor | base theme color for the number stepper (default Grey) |
labelWidth | width of the label (default 80 pixels) |
inputWidth | width of the field (default 70 pixels) |
color | base theme color for the field font and label (default MediumGrey) |
fontSize | size of the font used (default 10) |
changeHandler | function onNumberInputChange(value:Number):void |
public function set value( float: Number ):void
Change the field to a new numeric value. Uses the precision set for the field to limit the number of digits displayed after the decimal point. Triggers a change callback if one is set.
float | new integer value |
private function increment():void
Increments the field value when the user clicks or auto-repeats the up stepper button by keeping it pressed. The increment is calculated relative to the current value of the field. At zero it is the step value set for the field. The value is limited at the maximum value set for the field.
private function decrement():void
Decrements the field value when the user clicks or auto-repeats the down stepper button by keeping it pressed. The decrement is calculated relative to the current value of the field. At zero it is the step value set for the field. The value is limited at the minimum value set for the field.
Default width of the optional label in pixels
public static const DEFAULT_LABEL_WIDTH: uint
Default width of the numeric input field in pixels
public static const DEFAULT_INPUT_WIDTH: uint
Default color of the text in the field and the label
public static const defaultColor: int
A medium default size for the font.
public static const defaultFontSize: int
Stepper size, each stepper is square
public static const defaultStepperSize: int
Internal text field used to display and edit the data.
private var input: TextField
Small stepper/spin button for incrementing the value in the field.
private var plusButton: ShapeButton
Small stepper/spin button for decrementing the value in the field.
private var minusButton: ShapeButton
Callback function called when the field has been changed.
private var callback: Function
Base theme color of the stepper buttons
private var stepColor: uint
Number of fractional decimal digits shown
public var precision: int
Step size used when incrementing/decrementing
public var step: Number
The smallest value that the field will be decremented to.
public var minimum: Number
The largest value that the field will be incremented to.
public var maximum: Number
Creates a floating point number input field with an optional label and optional auto-repeating stepper buttons.
public function NumberInput( owner: String, labelText: String = null, inputValue: Number = 0.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 )
Get the numeric value from the field.
public function get value():Number
Increments the field value when the user clicks or auto-repeats the up stepper button by keeping it pressed.
private function increment():void
Decrements the field value when the user clicks or auto-repeats the down stepper button by keeping it pressed.
private function decrement():void
Triggers a set change callback when the text in the input field has been changed.
private function inputChangeHandler( event: Event ):void
Sets the state of the widget to active or inactive.
public function set active( state: Boolean ):void
Activates the widget, adds its event listeners
private function activate():void
Disactivates the widget, removes its event listeners
private function disactivate():void
Dispose of all resources used or referenced in the instance.
public function dispose():void
Removes used resources, references and graphics
private function destructor():void
Register the owner of a widget.
public function register( owner: String ):void