Be a Supporter!

Stoping sound w/out changing code?

  • 175 Views
  • 3 Replies
New Topic
mcgyvr2009i
mcgyvr2009i
  • Member since: Dec. 23, 2010
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Stoping sound w/out changing code? Feb. 3rd, 2013 @ 01:10 PM

Hi. 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.


Thanks in advance.
Ian Hulett

smulse
smulse
  • Member since: Mar. 24, 2005
  • Offline.
Forum Stats
Member
Level 31
Blank Slate
Response to Stoping sound w/out changing code? Feb. 3rd, 2013 @ 06:00 PM

You'll have better luck with Actionscript related questions in the Flash forum


BBS Signature
mcgyvr2009i
mcgyvr2009i
  • Member since: Dec. 23, 2010
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Stoping sound w/out changing code? Feb. 4th, 2013 @ 08:10 AM

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.


Thanks in advance.
Ian Hulett

mcgyvr2009i
mcgyvr2009i
  • Member since: Dec. 23, 2010
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Stoping sound w/out changing code? Feb. 4th, 2013 @ 08:12 AM

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


Thanks in advance.
Ian Hulett