PDA

View Full Version : Deleting FLVPlayback


pcmxa
03-02-2008, 01:12 AM
Hello,

I know this has probably been asked here before, but I can' seem to find it when I search...

I have a button that calls a function (below) that adds an FLVPlayback object to the stage. The first time the button is pressed it adds the object (this works fine), the second time the button is pressed I would like to remove the FLVPlayback object. I want to remove it so it is no longer occupying memory, not just stopping or hiding it.

function cacaphony(evt) {
cacaphonyP *=-1;
if (cacaphonyP == 1) {
var speaker1:FLVPlayback = new FLVPlayback();
speaker1.width=116;
speaker1.height=150;
speaker1.x = 0+176;
speaker1.y=150;
addChild(speaker1);
speaker1.load("spoken/spoken"+(Math.round(Math.random()*106+1))+".flv");
speaker1.play();
} else {
//code to remove speaker 1 here
}
}

Thanks

matbury
03-02-2008, 03:33 AM
removeChild(speaker1);
speaker1 = null;