Ultrashock Tutorials > Flash MX 2004 > Flash MX 2004 UI Components  
 
by Aral Balkan,  BitsAndPixels.co.uk 
Download Source Files (5MB!)  
 
Flash MX 2004 UI Components
 

 01. v1 Components, We Hardly Knew Ye 
 02. Button Component 
 03. Alert Component 
 04. Checkbox Component 
 05. Radio Buttons 
 06. The List Box family of Components 
 07. Date Chooser Component 
 08. Date Field Component 
 09. Label Component 

 10. Loader / Progress Bar Components 
 11. Numeric Stepper Component 
 12. Text Area/Input Components 
 13. Menu / Menu Bar Components 
 14. Scroll Pane Component 
 15. Window Component 
 16. Tree Component 
 17. Accordion Component 
 18. Conclusion 

Aral Balkan is co-author of
Flash MX Components Most Wanted.
Click to check it out at Amazon.com!
- discuss this tutorial -

11. Numeric Stepper Component

The Number Stepper is useful for letting the user select a numeric value with known limits and a known step-size between choices. It is much better to use a Numeric Stepper with a lower and upper limit than to use a textfield and then tell the user that they entered the wrong value (too low/too high). Here's a simple example showing you how to use this component.

  1. Start a new FLA and use the screenshot below as a guide when laying out the movie in the latter steps.



  2. Create two new layers. Call the topmost one Actions and the other two, Component and Fill.

  3. Drag a Numeric Stepper component on stage, into the Component layer. Set its instance name and component parameters using the Property Inspector, as shown below.



  4. (Optional; Eye-Candy) Create a light-gray fill in the Fill layer to accentuate the 3D shadow of the component. Add a Static Text Field to label the component.

  5. Enter the following code in the Actions layer.
    // create event listener object for stepper
    ageStepperListener = new Object(); 
    // change event handler
    ageStepperListener.change = function(eventObject)
    {
        var theStepper = eventObject.target;
        var theValue = theStepper.value;
               
        trace ("You just selected " + theValue );
    }
               
    // register the event listener
    ageStepper.addEventListener("change", ageStepperListener);
  6. Test the movie. Click on the arrows of the Stepper and note the messages that get traced out into the Output window. The code, in this case, should be self-explanatory.


- discuss this tutorial -
 
©2003 Ultrashock.com - All rights reserved