Forum Moderators: open
Home Label action
var mySound:Sound = new Sound(this);
mySound.loadSound("music/music.mp3", true);//Set true to stream
mySound.onSoundComplete = function() {//loop it
this.start(0);
}
What might be better is to define the sound and sound source in the first frame then hit play on mouse over of label?
Here's a quick copy/paste from one of my players, but it has a start and stop button. The start/stop buttons are on top of each other, so when playing it turns into a stop button and vice versa. You can guess the other symbols I have by what I've named them. All in an actions layer, entire player is one frame.
var soundOn;
_root.stoptext._visible=false;
mySound = new Sound();
mySound.attachSound('pro-plain44hx64kbps');
mySound.onSoundComplete = function() { toggleSound(); };
function toggleSound() {
if (soundOn==1) {
_root.heartext._visible=true;
_root.stoptext._visible=false;
_root.logo._alpha=100;
_root.speaker._alpha=100;
_root.ear._alpha=100;
mySound.stop();
soundOn=0;
}
else {
_root.stoptext._visible=true;
_root.heartext._visible=false;
_root.logo._alpha=25;
_root.speaker._alpha=25;
_root.ear._alpha=25;
mySound.start();
soundOn=1;
}
}