2 Replies Latest reply on Mar 14, 2011 6:46 AM by jaswerl

    Display and play movie clips at random.

    jaswerl

      Hi adepts!

       

      I am trying to place 6 movie clips in an array and access them in a random manner so that when a button is pressed a movieclip appears and plays randomly.

      All MCs are in frame one along with this code:

       

      stop();
      blk1._visible=false;
      blk2._visible=false;
      blk3._visible=false;
      ppk1._visible=false;
      ppk2._visible=false;
      ppk3._visible=false;

      storeCartons = new Array();
      storeCartons = (blk1, blk2, blk3, ppk1, ppk2, ppk3);

      startButton.onMouseUp = function(){
      trace(myNumber);

      myNumber=Math.floor(Math.random()*7)+ 0;
      activeCarton = storeCartons(myNumber);
      activeCarton._visible=true;

      }
        how can I get this to work??

        • 1. Re: Display and play movie clips at random.
          nitesh836

          Here is the updated code.

           

          stop();
          blk1._visible = false;
          blk2._visible = false;
          blk3._visible = false;
          ppk1._visible = false;
          ppk2._visible = false;
          ppk3._visible = false;

           

          storeCartons = new Array();
          storeCartons = [blk1, blk2, blk3, ppk1, ppk2, ppk3];

           

          startButton.onRelease = function() {
              myNumber = Math.floor(Math.random()*storeCartons.length);
              trace("myNumber "+myNumber);
              activeCarton = storeCartons[myNumber];
              activeCarton._visible = true;

           

          };

          • 2. Re: Display and play movie clips at random.
            jaswerl Level 1

            Thank You nitesh836! This is a correct answer. I take it that button actions are

            different than mouse actions. Where can I go to find out button actions?