Copy link to clipboard
Copied
I have a slideshow setup to load on a random frame using this:
function onEnter(evt){
if(loaderInfo.bytesLoaded == loaderInfo.bytesTotal){
visible = true;
gotoAndPlay(int(Math.random()*totalFrames)+1);
removeEventListener('enterFrame',onEnter);
stop();
}
There are 16 frames, yet I want it to only load a random frame from the first 8. What do I need to change with gotoAndPlay to make it only choose a random frame from the first 8?
Thanks
Just replace totalFrames with the value 8. If you are certain totalFrames will always be 16 you could use totalFrames/2
Copy link to clipboard
Copied
Just replace totalFrames with the value 8. If you are certain totalFrames will always be 16 you could use totalFrames/2
Copy link to clipboard
Copied
(and, get rid of that stop() if you really want the timeline to play.)
Find more inspiration, events, and resources on the new Adobe Community
Explore Now