EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 104

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
104 Chapter 5: Creating Interaction with ActionScript
8 Enter the following actions:
onClipEvent (load) {
top = _y;
bottom = _y;
left = _x;
right = _x+100;
_x += 100;
}
onClipEvent (enterFrame) {
_parent.song.setVolume(_x-left);
}
9 Select Control > Test Movie to use the volume slider.
To create a sliding balance control:
1 Drag a button to the Stage.
2 Select the button and select Insert > Convert to Symbol. Select the movie clip property.
3 Select the movie clip and select Edit > Edit Symbol.
4 Select the button and select Window > Development Panels > Actions.
5 Enter the following actions:
on (press) {
startDrag ("", false, left, top, right, bottom);
dragging = true;
}
on (release, releaseOutside) {
stopDrag ();
dragging = false;
}
The startDrag() parameters left, top, right, and bottom are variables set in a clip action.
6 Select Edit > Edit Document to return to the main Timeline.
7 Select the movie clip on the Stage.
8 Enter the following actions:
onClipEvent(load){
top=_y;
bottom=_y;
left=_x-50;
right=_x+50;
center=_x;
}
onClipEvent(enterFrame){
if (dragging==true){
_parent.setPan((_x-center)*2);
}
}
9 Select Control > Test Movie to use the balance slider.
For more information about the methods of the Sound class, see the Sound class entry in
Chapter 12, ā€œActionScript Dictionary,ā€ on page 205.

Table of Contents

Related product manuals