Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Random frame

New Here ,
Mar 11, 2013 Mar 11, 2013

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

TOPICS
ActionScript
485
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Mar 11, 2013 Mar 11, 2013

Just replace totalFrames with the value 8.  If you are certain totalFrames will always be 16 you could use totalFrames/2

Translate
LEGEND ,
Mar 11, 2013 Mar 11, 2013

Just replace totalFrames with the value 8.  If you are certain totalFrames will always be 16 you could use totalFrames/2

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 12, 2013 Mar 12, 2013
LATEST

(and, get rid of that stop() if you really want the timeline to play.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines