Can anyone help me for this?

pls download .fla and open itt
Download 5MB

as u can see, there is stop,play,volumn bar…
when run it, i need to press play button to play and also to drag the volumn in order to play the song…

now what i wan is the song will be auto play after run the flash, and the volumn dragger can set the middle which also means the volumn will be set to 50% instead of 0%

anyone know this, pls teach me :P:D thanks…

link doesn’t work

*Originally posted by scotty *
**link doesn’t work **

link fixed :wink:

first:
put the “dragger” in mc"mySlider" in the middle.

second:
put this as in the code layer
[AS]this.ratio = 50;
dragger.onPress = function() {
this.startDrag(true, 0, 0, line._width, 0);
this.onEnterFrame = function() {
ratio = Math.round(this._x*100/line._width);
};
};
dragger.onRelease = dragger.onreleaseOutside=stopDrag;[/AS]

third:
put this as on your mySlider mc
[AS]onClipEvent (load) {
mySound = new Sound();
choice = Math.round(Math.random()*1);
switch (choice) {
case 0 :
mySound.loadSound(“SONG1.mp3”, false);
break;
case 1 :
mySound.loadSound(“SONG2.mp3”, false);
break;
}
this.onEnterFrame = function() {
downloaded = mySound.getBytesLoaded();
total = mySound.getBytesTotal();
if (downloaded != total) {
_root.dl = “downloading song…”;
} else {
complete = 1;
_root.dl = “”;
mySound.start(0, 99);
delete this.onEnterFrame;
}
};
}
onClipEvent (enterFrame) {
mySound.setVolume(ratio);
}[/AS]

that should work:smirk:

scotty

thx buddy ^^

but i dun understand this

delete this.onEnterFrame;

why need delete ?

that onEnterFrame is deleted as soon as the sound is completely loaded and the music starts. if you don’t delete it, music will start on every enterframe, i think you wouldn’t this to happen (try to skip it and see/hear what’s happening(-: )

scotty