PDA

View Full Version : Playing Sounds


canarybirdfly
05-13-2010, 06:10 PM
I've been trying to get sounds to work in AS3 I've been importing them and applying Linkage as you do but for some reason they haven't been playing, or only one plays when called.

Code below, can anyone think as to what I'm doing wrong?

function killKoala(temp) {
temp.visible = false;
gameOver = true;
var cs:explosionID=new explosionID
setChildIndex(gameOver_mc, numChildren - 1);
setChildIndex(restart_btn, numChildren - 1);
gameOver_mc.visible = true;
gameOver_mc.gotoAndPlay(1);
}

function exitKoala(temp) {
// remove temp koala from koala array

var index:int = koalas.indexOf(temp);
koalas.splice(index, 1);

//temp.visible = false;
temp.gotoAndStop("stand")
temp.x=40*rescuedTotal+180;
temp.y=20;

// move to rescued array
rescued.push(temp);
//plays Bonza sound from Koala
var cs:savedID=new savedID
cs.play();

// remove event listener
temp.removeEventListener(Event.ENTER_FRAME, moveKoala);
}

henke37
05-14-2010, 10:29 AM
The first cs object is never used once created. And it's considered poor practice to leave out the paranteses when constructing a new object.