We help IT Professionals succeed at work.
Get Started

AS3: I am unable to stop a sound using "stop"...

cubical38 asked
Last Modified: 2013-12-21
I am trying to stop a sound on MOUSE_UP.  This works fine if I use:  SoundMixer.stopAll();...  This is not going to work as I have a looping song in the background that will continue until otherwise stated.  Code is below:

if I replace:  SoundMixer.stopAll();  with Chisel_Sound_active.stop();  I receive this lovely error:

1061: Call to a possibly undefined method stop through a reference with static type flash.media:Sound.
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down);
stage.addEventListener(MouseEvent.MOUSE_UP, mouse_up);
var req:URLRequest = new URLRequest("Chisel.mp3");
var Chisel_Sound_active:Sound = new Sound(req);
var sound:URLRequest = new URLRequest("ChiselWindDown.mp3");
var Chisel_WindDown:Sound = new Sound(sound);
function mouse_down(e:MouseEvent) {
	if (mouseX < 800 && mouseY < 570) {
/*------function just like above, just for the mouse up event-------*/
function mouse_up(e:MouseEvent) {

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE