I have 3 movieclips, each one has 7 frames and labels that play different images, I want to stop each one randomly, but never have them equal the same frame. I was thinking array.push once its called, but I dont know how to do that. So I have this so far:
function startGame(event:MouseEvent)
{
addChild(level6_mc);
addChild(inGameNav_mc);
level6_mc.gotoAndPlay(2);
var timer = setTimeout(startAgain, 1000);
startAgain();
}
// level 6
function startAgain()
{
var randomNumber:Number= Math.floor(Math.random()*7);
var door1 = level6_mc.door1_mc;
var door2 = level6_mc.door2_mc;
var door3 = level6_mc.door3_mc;
door1.gotoAndStop(randomNumber);
door2.gotoAndStop(randomNumber);
door3.gotoAndStop(randomNumber);
}
there has to be an easy way for this, I just cant figure it out. I have been looking all over the net for a solution, but every method is just so complicated. Can anyone help me find a simple solution, and if you tell me to use an array can you please give example. Thanks in advance
I would opt for an approach like this:
I don’t have Flash on this machine, so I can’t test. But the idea is that you have an array of frame numbers, 1-7 and you randomly choose 3 of those numbers to be your stop frames.