vendredi 29 mai 2015

as3; stop bg sound after replay game; avoid overlapping sound

I've made a little quiz for a school project. I stuck with some sound issues. I want to play a background sound when the player hit the start btn on the start screen. After the game is finished, you can replay it. So when you come to the start screen the sound is still playing und when you hit the start btn again, the sounds are overlapping. So the best would be, after clicking the replay btn the sound stops. And when you click the start btn the sound start again. This is my code from the start screen so far:


var bgSound:Sound = new bgsnd();
var bgChannel:SoundChannel = new SoundChannel();

start_btn.addEventListener(MouseEvent.CLICK, start_quiz)

function start_quiz(event:MouseEvent):void{
    bgChannel =;

function rebtnf(event:MouseEvent):void{

The replay btn start the function rebtnf. Works well to get to frame 1, but the sound continues to play.

Can someone help me? Hope so!

One Love, Monkeycel

Aucun commentaire:

Enregistrer un commentaire