|
Flash CS4 Resources |
Use the NumericStepper componentThe NumericStepper component allows a user to step through an ordered set of numbers. The component consists of a number in a text box displayed beside small up and down arrow buttons. When a user presses the buttons, the number is raised or lowered incrementally according to the unit specified in the stepSize parameter until the user releases the buttons or until the maximum or minimum value is reached. The text in the NumericStepper component’s text box is also editable. A live preview of each NumericStepper instance reflects the setting of the value parameter in the Property inspector or Component inspector. However, there is no mouse or keyboard interaction with the NumericStepper’s arrow buttons in the live preview. User interaction with the NumericStepper componentYou can use the NumericStepper component anywhere you want a user to select a numeric value. For example, you could use a NumericStepper component in a form to set the month, day, and year of a credit card expiration date. You could also use a NumericStepper component to allow a user to increase or decrease a font size. The NumericStepper component handles only numeric data. Also, you must resize the stepper while authoring to display more than two numeric places (for example, the numbers 5246 or 1.34). You can enable or disable a NumericStepper in an application. In the disabled state, a NumericStepper doesn’t receive mouse or keyboard input. When it’s enabled, the NumericStepper receives focus if you click it or tab to it, and its internal focus is set to the text box. When a NumericStepper instance has focus, you can use the following keys to control it:
For more information about controlling focus, see the FocusManager class in the ActionScript 3.0 Language and Components Reference and Work with FocusManager. NumericStepper component parametersYou can set the following parameters in the Property inspector or in the Component inspector for each NumericStepper instance: maximum , minimum , stepSize , and value . Each of these parameters has a corresponding ActionScript property of the same name. For information on the possible values for these parameters, see the NumericStepper class in the ActionScript 3.0 Language and Components Reference . Create an application with the NumericStepperThe following procedure explains how to add a NumericStepper component to an application while authoring. The example places a NumericStepper component and a Label component on the Stage and creates a listener for an Event . CHANGE event on the NumericStepper instance. When the value in the numeric stepper changes, the example displays the new value in the text property of the Label instance.
Create a NumericStepper using ActionScript:This example creates three NumericSteppers with ActionScript code, one each for entering the month, day, and year of the user’s date of birth. It also adds Labels for a prompt and for identifiers for each of the NumericSteppers.
|