replace alert with goto label
I have finally got some code together that generates a random number, and importantly doesnt repeat any of the numbers in the array until they have all been used. I have been testing it with an alert.
What I would like to do is go to specific frames in the timeline once it has generated these random numbers. My brain can't get around it and would appreciate any help.
this.stop();
var TheFramesArray = [1, 2, 3, 4];
var TheTotal = [];
var Blue_mc=this;
if (!Blue_mc.TempButton.hasEventListener("tick"))
{
Blue_mc.TempButton.addEventListener("tick",HeyHoLetsGo);
}
function HeyHoLetsGo() {
var LLRandomGenerator = Math.floor(Math.random() * TheFramesArray.length);
if (TheTotal.indexOf(LLRandomGenerator) == -1) {
TheTotal.push(LLRandomGenerator);
alert(TheFramesArray[LLRandomGenerator]);
} else {
HeyHoLetsGo();
}
//I think this resets the counter after all combinations
if (TheTotal.length == TheFramesArray.length)
TheTotal = [];
}
if (TheTotal == 1) {
this.gotoAndPlay(1);
} else if (TheTotal == 2) {
this.gotoAndPlay(2);
} else if (TheTotal == 3) {
this.gotoAndPlay(3);
} else {
this.gotoAndPlay(4);
}
