homepage Welcome to WebmasterWorld Guest from 54.197.111.87
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
Sound restarting at Home label
Walley




msg:3984422
 10:34 pm on Sep 4, 2009 (gmt 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);
}

 

rocknbil




msg:3984807
 7:03 pm on Sep 5, 2009 (gmt 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;
}
}

Walley




msg:3988036
 4:46 pm on Sep 11, 2009 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved