myMusic = new Sound(this);
Makes a new sound object in the timeline. This sound object does not yet contain any sound yet. It is like a CD player with out a CD.
myMusic.attachSound("mySound");
This attaches the sound from the Library which we called "mySound".
myMusic.start(0, 99);
This is an auto-start. It instructs the sound file to start to play. (The files at the top of this page do not have this - on my files you must hit the play button). Once the file starts to play it will loop 99 times.
slider.control._y = -50;
Sets the initial volume to 50% full volume. 0 is off and -100 is full volume. Remember that -100 is the top of the slider scale (step 2.20 above).
slider.control.onEnterFrame = function() {
myMusic.setVolume(0-this._y);
}
Sets the volume to be what every the y value of slider control. As we slide the controller up and down the volume goes according to the y value. The (0-this._y) converts all the negative numbers to positive so the volume scale is actually 0 to 100 (not 0 to -100).
Note - Rotation: What is strange is that if you rotate the slider on the main stage to make a horizontal control - the symbols nested inside are not considered to have been rotated. This means that the y value still works! You do not need to convert the ActionScript to an x value.
Note - Size: This same is also true of size. If you change the size of the controller on the main Stage the y scale inside the re-sized controller is still 0 to -100. The sizing on Stage makes no difference to measurements of objects nested inside a symbol.
slider.control.onPress = function() {
startDrag(this, false, this._x, -100, this._x, 0);
}
This makes the slider move when it is dragged with the mouse. Its movement is restricted between 0 and -100.
slider.control.onRelease = function() {
stopDrag();
}
When you let go of the mouse the slider will stop moving.
