i am following these tuts but evrything is working fine but what i want is that my music should start playing immediately as it is loaded rather then waiting to click button to play…
so far i tried is:
[color=navy]onClipEvent (load) {
mySound = new Sound();
mySound.loadSound("_jUsT-Rudy_Ves-8003_hifi.mp3", false);
[/color] [color=darkorange]mySound.onLoad = playSound();
function playSound(success) {
if (success) {
mySound.start();
}
[/color] [color=navy]}
}
onClipEvent (enterFrame) {
downloaded = mySound.getBytesLoaded();
total = mySound.getBytesTotal();
if (downloaded != total) {
_root.dl = “downloading song…”;
} else {
complete = 1;
_root.dl = “playing”;
}
mySound.setVolume(_root.volume*2);
}
[/color]
[color=black]where i a going wrong…???[/color]
[color=black]help me[/color]
onClipEvent (load) {
mySound = new Sound();
mySound.loadSound("_jUsT-Rudy_Ves-8003_hifi.mp3", false);
mySound.onLoad = playSound();
function playSound() {
mySound.start();
}
If that’s not working, my guess is that is not reaches the playSound function because the code gets executed only onload? ANd this line “mySound.onLoad = playSound();
” when the sound is acctually loaded… isn’t invoked anymore…
Put this line in your onClipEvent (enterFrame)
Obviously your sound play just 'cause u’ve used the movieclip event handler. Try to load the sound from the first frame of the movie instead of assign that to the onLoad () event hanlder of movieclip.
_root.onLoad = function (){
//Your code goes here.
}
Assign the code for button on later to play the music.
/:mybutton.onRelease = function (){
mySound.start();
}
The onClipEnterFrame is, i hope, ok to check the downloading status of the sound…