Create a Flash 5 Remixer (cont...)

Create a Volume Slider
A slider consists of three parts: a button representing the handle, a movie clip to hold the button, and a graphic representing the slider "groove". A user drags the slider up or down its groove to change volume.

To create a slider you must constrain the drag space of a movie clip. A movie clip's registration point, with the cross hair icon typically in the center of the clip, represents its current x and y position on the stage. By passing coordinates to the startDrag(( ) method you define a rectangle within which a user can drag the movie clip.

The constrained area of your volume slider will be a vertical line 1 pixel wide and 100 pixels high, which corresponds to the Flash player's volume range of 0 - 100. The default position of your slider is the top of the slider "groove" representing maximum volume. I am using the default value of 100 to simplify the slider building process. Later on, when you are more comfortable with the process you can change the default setting of your volume slider.


Figure 2. Constrained Drag Space for Volume Slider

1. Create a button representing your slider handle and place it within movie clip.

2. Add the following ActionScript to the button:
   on (press) {
	   startDrag("", false, left, top, right, bottom);
	   dragging = true;
   }

   on(release, releaseOutside) {
	   stopDrag( );
	   dragging = false;
   }

3.	Select the movie clip and add the following Actions:

   onClipEvent(load) {
	   top = Math.round(_y); // default position
	   left = Math.round(_x);
	   right = left; // prevent horizontal drag
	   bottom = top + 100 //100 pixels below top
   }
4. Place the slider movie clip on the stage and name it for its corresponding audio track, such as 'drumVolSlider".

5. Create a slider "groove" graphic on the main timeline and align the top of the slider movie clip with the top of the groove. The groove should be 100 pixels high plus the height of your slider handle to compensate for the slider's centered registration point.


Introduction

Create a Pan Slider

In this Article
Introduction Create a Pan Slider Add Audio Tracks
Create a Volume Slider Create a Mute Toggle Button Wiring Your Console for Sound







FEATURE SOFTWARE:
html++ Dynamic HTML Class Library
Build dynamic web pages using C++ Class Libraries instead of HTML tags.
Buy Now!

FEATURE BOOK:
Encrypt It
Encrypt and Decrypt Data, Passwords and Files within your application.
Buy Now!
Download All the Code from this article

Power Up Your ASP Front Ends with Flash

DHTML Zone

Get Help with DHTML

Other Sample Remixers
Abadja Rhythm

AudioMeister

Resequencer

Trance Galaxy





 
Sponsored Links

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map
Jupiterweb networks

internet.comearthweb.comDevx.comClickZ

Search Jupiterweb:

Jupitermedia Corporation has four divisions:
JupiterWeb, JupiterResearch, JupiterEvents, and JupiterImages

Copyright 2004 Jupitermedia Corporation All Rights Reserved.
Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Jupitermedia Corporate Info | Newsletters | Tech Jobs | E-mail Offers

Copyright Information/Privacy Statement