7 Replies Latest reply on Dec 10, 2009 12:50 PM by kglad

    Looking for help with movie loading in a different spot every time page reloads.

    akwilinski

      Hello,

      I have a Flash movie that I need to jump to a one of 6 chosen frames when say a user hits the back button or home in the site. I just dont want the same user seeing the flash movie replay in the same spot everytime they go back to home.

       

      ANY help with this is appreciated.

      Thanks ahead of time.

       

      -Ann

       

      Here is what I have scripted:

       

      var numbers:Array = [2,114,415,687,960,1195,1485];

      _root.firstTime = true;

      if(firstTime) {

          firstTime = false;

          var frame:Number = Math.floor(Math.random() * numbers.Length);

          gotoAndPlay(numbers[frame]);

      }

       

       

      I have also tried this:

       

       

      Array.prototype.shuffle = function() {
      for (var ivar = this.length-1; ivar>=0; ivar--) {
      var p = random(ivar+1);
      var t = this[ivar];
      this[ivar] = this[p];
      this[p] = t;
      }
      };
      ASSetPropFlags(Array.prototype, ["shuffle"], 1, 1);
      var Array_ar:Array = new Array(2,114,415,687,960,1195,1485);
      Array_ar.shuffle();
      index = 0;
      function load_random() {
      gotoAndPlay(Array_ar[index++]);
      if (index == Array_ar.length) {
      (index=0);
      }
      }
      load_random();

       

      But this keep jumping to frame 1 each time i hit back or refresh.

       

      Thanks again.