PDA

View Full Version : stop sound button


maryus
01-30-2009, 03:57 PM
Hi. I have a fla whose main timeline stops at frame 25, where this code is called:

stop();
myMusic = new Sound(this);
myMusic.attachSound("mySound");
myMusic.start(0, 999);
slider.control._y = -50;
slider.control.onEnterFrame = function() {
myMusic.setVolume(0-this._y);
}
slider.control.onPress = function() {
startDrag(this, false, this._x, -100, this._x, 0);
}
slider.control.onRelease = function() {
stopDrag();
}

The frame holds a soundtrack (that is, "mySound"), looping 999 times, set as event and repeat (the slider controls well, control a volume slide, you know).

Still in the frame 25, I have a button that pops a window (let's call it "holder") from a resident MC, which loads in itself an external swf, where I have a main timeline made of 3 frames; the first has a preloader, the 2d has 1 button, with this action

on(release){StopAllSounds();gotoAndStop("playthemusic");}

where the frame labeled "playthemusic" (the third of them, obviously) holds another soundtrack, linked as "sd1"; I putted "StopAllSounds" in order to stop the parent soundtrack (but I dunno whether there was a better method), so it won't overlap "sd1".

In the resident MC, I have a button, which closes the "holder" window and unloads its external MC, and which (in my intentions) had to start again the soundtrack of the main timeline's frame 25.

My question is: what code should I put in that button, in order to restart the sound? Please help. Thanks.

endergrl
01-30-2009, 06:23 PM
Are you using as2 or as3? You can check out the stuff on adobe.com to find out exactly which functions will do what you want, but typically it sound.start and sound.stop.

maryus
01-30-2009, 07:07 PM
Are you using as2 or as3? You can check out the stuff on adobe.com to find out exactly which functions will do what you want, but typically it sound.start and sound.stop.
I'm on AS2. I know the function, but I tried to implement, and it didn't worked. Perhaps I mistake something. That's why I asked.

endergrl
01-30-2009, 07:15 PM
oh, sorry, I guess I misunderstood what you were asking. I'm not really sure what you need to do. Good Luck :)

atomic
01-30-2009, 07:20 PM
Attach or provide a link to your .fla.

maryus
01-31-2009, 03:17 PM
I had to select only what matters, 'cause otherwise it weighted 20 megs (and even after that, I had to save it as a swf, and decompile it as a fla, 'cause it still weighted 9 megs). Now it weights 832 kb zipped; here only 500 kb is allowed!

atomic
01-31-2009, 04:46 PM
Upload the complete original .fla to a file sharing site as www.rapidshare.com , and provide here the link to download it from there...

maryus
01-31-2009, 05:05 PM
Ok, here it is

file (http://rapidshare.com/files/192112917/tink.zip.html)

Many thanks.
THIS IS THE ONE RIGHT, sorry, I got confused between abridged and full :-(

atomic
01-31-2009, 07:00 PM
Can you provide the multimedia.fla also?

maryus
01-31-2009, 09:33 PM
here it is file (http://rapidshare.com/files/192203648/multimedia.fla.html)

atomic
01-31-2009, 10:35 PM
A quick fix...

Extend your navs & buttspers layer so that their content is also on frame 24, not only on frame 25...

Next, change your script on frame 70, to ...

stop();
_root.gotoAndPlay(24);
//_root.scherm.gotoAndStop("1");

You don't need to reset the scherm mc, it will reset itself.

maryus
02-01-2009, 02:32 PM
Ok, and I should put a stop in frame 25?

atomic
02-01-2009, 03:16 PM
You already have one.

maryus
02-02-2009, 10:43 PM
Ok ty; I guess that it isn't yet the moment for a playallsounds function.....

atomic
02-03-2009, 01:48 AM
You could use soundObjects to control their volume, mute them and unmute them with even fade in's & fade out's... But in your case, having the playhead simply play the previous sound, is really the easiest and fastest workarond.

maryus
02-03-2009, 10:45 AM
Ok, done, it works. I had to put a stopallsounds command in 24, 'cause often the sound overlapped twice on return.
Just one last thing: why the volume slider still slides, like following the mouse sticked upon it, even after I clicked and moved it?

TY.

atomic
02-03-2009, 02:59 PM
Ummmmmh! Deleted your files, so I can't check...

Make sure you have a release outside as well on your stopDrag script, as...

on(release, releaseOutside){
stopDrag();
}