9.9. Using Slider Controls

Problem

You want to use a slider control.

Solution

Use an instance of the RightActionScript HorizontalSlider or VerticalSlider.

Discussion

Slider controls are useful and even necessary in a whole host of possible applications. The ways in which you might use a slider include, but are not limited to:

  • Adjusting the volume of a sound

  • Adjusting the pan of a sound

  • Changing color values for a movie clip

  • Changing transparency for a movie clip

  • Allowing users to select values for a form

However, Flash does not have any (practical) built-in slider controls that you can use in your applications. While there are a few sliders in the Buttons Common Library, they are difficult to use and to customize. If you want to use a slider component, it is recommended that you either write your own (which is outside the scope of this book) or use a third-party component. In this recipe, you’ll find instructions for using and customizing the RightActionScript HorizontalSlider and VerticalSlider components.

Using a horizontal or vertical slider doesn’t require many steps. In order to add an instance to a project, drag an instance from the Components panel to the stage. If you then test the movie, you’ll see a functioning slider at the default dimensions and with the default artwork.

Tip

The horizontal and vertical sliders have identical parameters and they work identically. The primary difference between them is that one is horizontal and one is vertical.

By default, the sliders have minimum values ...

Get Flash 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.