4 Replies Latest reply on May 1, 2006 9:49 PM by Craig Grummitt

    movie clips

    thefulleffect
      i have 4 instances of the same movie clip in a vertical line on the main stage. im wanting to create a classic according esque menu. (user click the top one, the other three move down....user clicks the second one down, the 3rd and 4th ones move down and the 1st two stay in place)

      heres the AS:

      b1.onMouseDown = showP1;
      b2.onMouseDown = showP2;

      function showP1() {
      b1._x = 40;
      b1._y = 40;
      b2._x = 40;
      b2._y = 238;
      b3._x = 40;
      b3._y = 256;
      b4._x = 40;
      b4._y = 274;
      }

      function showP2() {
      b1._x = 40;
      b1._y = 40;
      b2._x = 40;
      b2._y = 58;
      b3._x = 40;
      b3._y = 256;
      b4._x = 40;
      b4._y = 292;
      }


        • 1. Re: movie clips
          thefulleffect Level 1
          im new to flash but understand programming concepts.

          how would one create a for or while loop to increase the position by one pixel on each iteration until a certain value is reached?
          • 2. Re: movie clips
            shyaway
            for (var i = 0; i<myLimit; i++){
            someValue++; //increment by 1
            someOtherValue +=5; //increment by 5
            }
            • 3. Re: movie clips
              thefulleffect Level 1
              problem 1: the first post doesnt work.
              when the user clicks b1, b2, b3 or b4, only the code in function showP1 is executed. is there a rule about not being able to change the coords multiple times in one frame?

              problem 2: dynamic tween
              i want to click on one mc, and have the other mcs move down accordingly, heres what i have:

              function showP1() {
              b1._x = 40;
              b1._y = 40;
              var b2ycoord:Number = 58;
              var b3ycoord:Number = 76;
              var b4ycoord:Number = 94;
              for (var i = 0; i<239; i++){
              b2ycoord++;
              b2._y = b2ycoord;
              }
              for (var i = 0; i<257; i++){
              b3ycoord++;
              b3._y = b3ycoord;
              }
              for (var i = 0; i<275; i++){
              b4ycoord++;
              b4._y = b4ycoord;
              }
              }



              any ideas?
              • 4. Re: movie clips
                Craig Grummitt Level 3
                Yeah there is a rule about not being able to change the coords multiple times in one frame - basically the screen gets refreshed once per frame. Regardless of what you do during the frame, you'll only see the state of the graphics at the end of the action/script for that frame.

                If you're wanting to see the movement, rather than a for loop, try either onEnterFrame which performs an action at the beginning of each frame, or setInterval which calls a function at the specified millisecond interval.