4 Replies Latest reply on Mar 18, 2007 8:38 PM by kglad

    Random Shuffe Array


      Hello Action Script Writers,

      I am new to action script although understand the basic programming principals
      and have worked from template scripts in the past.

      I would like to place a piece of script within 1 cell which will then
      request 1 of 5 files on a random basis (named 1.swf - 5.swf)

      if you can help an explanation of your code would also be appreciated.

      thank you

        • 1. Random Shuffe Array
          eric76 Level 1
          This should work. Check the Flash help for description of the loader, Math.random() etc.
          • 2. Re: Random Shuffe Array
            kglad Adobe Community Professional & MVP
            the shuffle() method for arrays is to be used when you don't want repeats. otherwise, the simple code given by eric is sufficient.
            • 3. Random Shuffe Array
              Script_Newbie Level 1
              thats great thanks, i'll experiment with it


              i need to be more particular about the array qualities as
              i intend to use the final code 6 times with variations
              across 6 TV channels / Cells.

              In other words, in

              cell 1 = movie channel

              play random but dont repeat 1.swf - 99.swf

              cell 2 = sports channel

              play random but dont repeat 100.swf - 199.swf

              i already have a radomiser to land on any one of the 6 channels.

              The objective is that with these 6 new shuffle arrays

              (each shuffle array defining the .swf parameters for that channel...
              ie 1.swf - 99.swf)

              are combined with the existing channel randomiser viewers will be
              able to land randomly across 600 shows.

              you can see a working example of the channel randomiser at www.bulletprooftv.com

              • 4. Re: Random Shuffe Array
                kglad Adobe Community Professional & MVP
                check this forum for the array.shuffle() method if you need it.