Ultimate Gear War
Join the alien war, prepare your gear and protect your base at all cost!
4.17 / 5.00 16,370 ViewsHi. I'm trying to find out how to stop a sound without changing the code I already have.
This is the AS3 I currently have right now:
//importing classes
import flash.display.Stage;
import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.media.Sound
//tell the animation to stop
stop();
//data
var titleBGM:Sound = new titleTheme();
titleBGM.play();
var swordSFX:Sound = new swordHit();
//function setup
addEventListener(MouseEvent.CLICK, onNewGame);
function onNewGame(e:MouseEvent):void
{
swordSFX.play();
gotoAndStop('81');
}
What this script is saying:
1) When the title screen loads - Play Title Screen
2) When user clicks NEWGAME - goes to frame 81, and plays the select soundEffect. (the one labeled 'swordSFX')
Here's what it doesn't do:
When the player clicks the new game button, I want it to go to frame 81, but first, I want it to stop the title screen theme and play the swordSFX variable, which it doesn't do. I tried to stop the title theme with SoundMixer.stopAll(); function. It stops the title screen, but it also prevents the SwordSFX var from doing it's thing. I tried SoundChannel, and that didn't work either.
What do I need to add to the script to get it to stop the title screen theme WITHOUT preventing the swordSFX sound from playing? Thanks.
Cheers!
Ian Hulett
You'll have better luck with Actionscript related questions in the Flash forum
At 2/3/13 06:00 PM, smulse wrote: You'll have better luck with Actionscript related questions in the Flash forum
At first I was going to question that, saying that this forum said that I should ask A.S. related questions in here, but then I reread the description and aparently, I read it wrong. It said what you said. lol I feel like an idiot. I'll post this in the flash forum.
Cheers!
Ian Hulett
At 2/4/13 08:10 AM, mcgyvr2009i wrote: I'll post this in the flash forum.
Oops, I meant I'll post my future ActionScript questions in the flash forum. XD
Cheers!
Ian Hulett