00:00
00:00
Newgrounds Background Image Theme

TarikNakich just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

[AS3] Next frame after sound ends

509 Views | 1 Reply
New Topic Respond to this Topic

[AS3] Next frame after sound ends 2015-06-17 07:34:03


Hi guys i got a simple request i guess

i'm just playing around with flash again after many years and all i wanna do is play a sound and then go to the next frame after the sound

stop();
stage.addEventListener(MouseEvent.CLICK,DoStuff);

function DoStuff(e:Event):void{
  var mysound:MySound = new MySound(); 
  mysound.play();
  // Something here???????
  gotoAndStop(2);
}

I cant seem to find the goto next frame after sound finishes. could anyone help me out please?


awww

Response to [AS3] Next frame after sound ends 2015-06-17 07:48:54


At 6/17/15 07:34 AM, LostVoices wrote: Hi guys i got a simple request i guess

i'm just playing around with flash again after many years and all i wanna do is play a sound and then go to the next frame after the sound

stop();
stage.addEventListener(MouseEvent.CLICK,DoStuff);

function DoStuff(e:Event):void{
var mysound:MySound = new MySound();
mysound.play();
// Something here???????
gotoAndStop(2);
}

I cant seem to find the goto next frame after sound finishes. could anyone help me out please?

You need to listen for the SOUND_COMPLETE event on the sound channel

var channel:SoundChannel =  mysound.play();
channel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);

function soundCompleteHandler(e:Event):void {
//Sound complete, do stuff
}

The water in Majorca don't taste like what it oughta.

| AS3: Main | AS2: Main | Flash Tutorials |

BBS Signature