Link to home
Start Free TrialLog in
Avatar of flashactions
flashactions

asked on

Flash cs3 stopAllSounds

ok im using flash cs3 and im working on a sound board.  I cave multiple buttons that play sounds when clicked.  ok I want a button that can stop the sounds from playing.  all the sounds.  I have attempted to use the stopAllSounds();    but i have not gotten it to work.    i am using the code in a method that has a mouse click event listner attached. like so.

function clickstop(evt:MouseEvent):void {
      stopAllSounds();
}
stopper.addEventListener(MouseEvent.CLICK, clickstop);

stopper is the instance name of the symbol i want to use as the stop button.  Ok so can the stop symbol be a button or a movie clip?  
and when i put this code into my fla document it plays through all the scenes instead of stopping on stop cues.  

and i did get a compiler error saying stopAllSound wasnt defined
Avatar of trigger-happy
trigger-happy
Flag of Philippines image

http://livedocs.adobe.com/flex/2/langref/flash/media/SoundMixer.html#stopAll()

Replace the stopAllSounds function with the flash.media.SoundMixer.stopAll() function.

Flash CS3 is very much different from the old flash because it makes use of the new AS3 API which was rewritten from the ground up. I suggest you look further into it using the link: http://livedocs.adobe.com/flex/2/langref/migration.html

--trigger-happy
Avatar of flashactions
flashactions

ASKER

OK so i replacced that line of code with the one you tole me to like so

function clickstop(evt:MouseEvent):void {
      flash.media.SoundMixer.stopAll()
}
stopper.addEventListener(MouseEvent.CLICK, clickstop);

ok and now i get a compiler error like so

TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at beatstreet_fla::MainTimeline/beatstreet_fla::frame1()
ASKER CERTIFIED SOLUTION
Avatar of trigger-happy
trigger-happy
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The first sentence "It seems the stopper doesn't really exist"  That was the problem.  i introduced the Stopper button in a later frame than where the action script lies.  I figured if the action script spanned all the slies it wouldnt be a problem to have the stop button on onpy one slide.   Im sure it possible.   But I ended up putting the stop button on the action script slide 1 and it worked fine.  Thank you.