• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2752
  • Last Modified:

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
0
flashactions
Asked:
flashactions
  • 2
  • 2
1 Solution
 
trigger-happyCommented:
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
0
 
flashactionsAuthor Commented:
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()
0
 
trigger-happyCommented:
It seems that stopper doesn't really exist. Can you post the rest of your code so that we can see what went wrong?

--trigger-happy
0
 
flashactionsAuthor Commented:
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.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now