so i’ve boggled over this for a while, and i’m not sure how to solve the prob.:diss:
this randomizer goes to the labeled frame and stops using the getRandomLabel function.
it works fine, but i have a gallery type navigation that cycles through the frames and then back to the beginning.
when it gets back to the beginning, it runs the randomizer function again. i don’t want it to do that. so i tried nesting this code in a movie clip and put it on the first frame of the timeline of my mc that it controls. that didn’t work either, because the navigation jumps back to the first frame anyways. my guess is that the solution is to put the randomizer code in a frame that the looping timeline never navigates to again, kind of like a preloader…
can you think of a more dynamic solution so the content doesn’t have a wierd blank frame at the beginning for 1/18ths of a second. what’s the code for ‘do this function once globally on this first frame, and then never do it again, even if the playhead navigates to this frame with this code again’… thanks for any help :party:
here’s my code:
//randomizer
function getRandomLabel():String {
var labels:Array = new Array(“a”,“b”,“c”,“d”,“e”,“f”,“g”,“h”,“i”,“j”,“k”,“l”);
var index:Number = Math.floor(Math.random() * labels.length);
return labels[index];
}
this.gotoAndStop(getRandomLabel());