Inches to Centimeters

The slider is one of the components that come with Flash CS5. We will use a slider to convert inches to centimeters. We will select the number of inches on the slider, then multiply the number of inches by 2.54 to get centimeters.
Get Adobe Flash player

  1. Start a new ActionScript movie.
  2. From the menu select Window, Components (Ctrl+F7)
    slider component
  3. Select the Slider and drag it to the stage.
  4. Open the property window and change the name to sldInches and the maximum to 100:
    slider properties
  5. If you want, use the free transform tool to make the slider longer.
  6. Create a text box and name it lblInches. Add a second text box named lblCM.
    label inches
  7. Write the code as shown below.
sldInches.addEventListener(MouseEvent.MOUSE_MOVE,showInches);
function showInches(e:MouseEvent): void {
   lblInches.text=""+sldInches.value;
   lblCM.text=""+sldInches.value*2.54;
} //showInches
Download the flash file
INDEX, Operators, Order of Operations, Algebra, Convert Inches to Feet and Inches using %, Sales Tax: Select decimal values with a Slider component
Next lesson: Math Functions

Copyright © Zebra0.com
All rights reserved worldwide.

 
 

Convert Inches to Feet and Inches using %