Welcome to WebmasterWorld Guest from 54.144.110.101

Forum Moderators: open

Message Too Old, No Replies

Sound restarting at Home label

     
10:34 pm on Sep 4, 2009 (gmt 0)

New User

5+ Year Member

joined:May 1, 2009
posts:24
votes: 0


I got the sound to play through the different labels. I just can't seem to figure out why it starts over when I go over to the Home Label. I'm guessing I have to some how check and see if the file is playing and if it is then create some if else statement. I just don't know how to do it.

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);
}
7:03 pm on Sept 5, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


Being your label action, whenever you hit the label it's creating a new instance of the sound and playing it, overwriting the old same-named instance.

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;
}
}
4:46 pm on Sept 11, 2009 (gmt 0)

New User

5+ Year Member

joined:May 1, 2009
posts:24
votes: 0


Thanks I ended up just making the sound file to its on clip and loading it
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members