Selteco Software
Selteco.com > FlashDesignerZONE.com > Tutorials > T1072

Display frames in random order.

Download source project t1072.zip (3 kb)

  1. Launch Flash Designer and choose Blank
  2. Set movie dimensions 230 x 100 (or any desired) with Frame > Frame Size
  3. Change frame delay to "0.05".
  4. Choose "Frame" > "ActionScript" and paste the code:
    
    // generate random number (f) but different than the last one (l)
    // the number will be between 1 and 6
    
    while(f==l) { f = Math.Floor(Math.Random()*6)+1; }
    
    // remember the last random number
    l = f;
    
    
    // jump to a frame 
    if(f==1) gotoAndPlay("Frame 2");
    if(f==2) gotoAndPlay("Frame 3");
    if(f==3) gotoAndPlay("Frame 4");
    if(f==4) gotoAndPlay("Frame 5");
    if(f==5) gotoAndPlay("Frame 6");
    if(f==6) gotoAndPlay("Frame 7");
    
    
  5. Choose "Frame" > "Insert", put Qty: 6 and delay 2 seconds
  6. Put graphics on each frame (from Frame 2 to Frame 7) for example numbers
  7. Hit F9 for preview.