-
can not stop an mp3
this compiles fine--and plays and loops "game1loop"--the loop stops when
"BtnStopSoundGOne" is pushed - but I want the mp3 to stop right away, not at the end of the file--I really do not think the "mySndCh.stop();" works here I think the loop stops when "loopsound = 0"
help!!!! I need the music to stop right away
sorry if the code is sloppy I am a noob
code:
var loopsound:Number;
var gameonesound:Sound = new game1loop();
var mySndCh:SoundChannel;
btnDrawGame.addEventListener(MouseEvent.MOUSE_DOWN ,btnDrawGameClick);
function btnDrawGameClick(e:MouseEvent):void {
if (btnLockOut == 0)
{
playMusic();
loopsound = 1;
//fscommand("exec","drawingSketchbig.exe");
}
}
function playMusic():void
{
trace("playMusic called");
gameonesound.play();
mySndCh = gameonesound.play();
mySndCh.addEventListener(Event.SOUND_COMPLETE, loopMusic);
}
function loopMusic(e:Event):void
{
if (loopsound == 1)
{
mySndCh.removeEventListener(Event.SOUND_COMPLETE, loopMusic);
playMusic();
}
}
BtnStopSoundGOne.addEventListener(MouseEvent.MOUSE _DOWN,BtnStopSoundGOneClick);
function BtnStopSoundGOneClick(e:Event):void
{
trace("stopsound called");
mySndCh.stop();
loopsound = 0;
}
-
Senior Member
May be add this line in the BtnStopSoundGOneClick function
mySndCh.removeEventListener(Event.SOUND_COMPLETE, loopMusic);
- The right of the People to create Flash movies shall not be infringed. -
-
Originally Posted by cancerinform
May be add this line in the BtnStopSoundGOneClick function
mySndCh.removeEventListener(Event.SOUND_COMPLETE, loopMusic);
tried it --same prob
the thing is I do not want to wait till the sound is complete
if the mySndChn.stop was working wouldn't it stop right away?
-
-
I put this in and it will stop the mp3
SoundMixer.stopAll();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|