Play random predefined set of frames
hi
i am pretty new to AS3 so i need a bit of help from you guys. I want to randomize the results when i press a button, right now i have this code. i have 5 Images. Each is set on a frame where only this image is visible. So i am randomizing the frames when i click on the button. Each time it gives me a random frame number and shows me the image on that frame. Here is the code (made this with a tutorial)
stop();
random_btn.addEventListener(MouseEvent.CLICK, choose);
function choose(event:MouseEvent):void{
var pic_number : Number = 6;
var randomFrame:Number = Math.ceil(Math.random() * pic_number);
trace(randomFrame);
gotoAndStop(randomFrame);
}
Right now i want to do this more advanced, i want to animate in the image. for example i have 5 animations, the first animation goes from frame 2 till 8, the second goes from 9 to 12 and etc, so i got a set of frames (2to8)(9to12) and not like in the previos where i just got one frame. Whats the best way to accomplish it, so pressing the button gives me each time a diffrent animation, it animates from start and then stops. I hope you can help me, thx