i write a few lines codes that when i click on the button, a random number will be generated. then a random child will be show up on the stage.
but i'm trying to when i click again on the button, the previous child has been removed and new child with new random number will be replaced.
how can i do that? or how can i find out what's the previous random number?
function clkBtn(evt:MouseEvent):void {
i=(Math.floor(Math.random()*10));
addChild(picP[i]);
removeChild(picP[?]);
}