1 Reply Latest reply on Sep 13, 2006 10:00 AM by CogDev

    Setting up a "random" scenario, but with exceptions...?

    Brett_Archibald
      I've got a Flash file that, when I press a button, sets a movie clip to jump to a particular random frame using the following code:

      gotoAndStop(random(52));

      which all works fine. Every time I press the button I get taken to a random frame, as expected.

      But what I want to do is for every time one of these random frames is landed on, I want that frame to be "ticked off" so that the NEXT random frame it lands on will NOT be that one. I want this to happen with EVERY press of the button, so that no frame can be landed on twice at any point.
      Then when I have eventually pressed the button 52 times, and therefore landed on ALL the frames, I want the whole thing to be re-set. I can do this second part by setting up a counter, and incrementing it each time the button is pressed, and then re-setting it when "presses == 52" etc.
      It's the first part I'm having trouble with -- how do I set up my file so that each frame that gets landed on gets "ticked off" so it is now excluded from the randomness of it all?

      Any help anyone...?

      Thanks!