3 Replies Latest reply on Dec 25, 2007 11:27 AM by kglad

    Loop through clips

    Level 7
      Hello,

      I'm trying to run a series of lines to shift the position of several movie
      clips. This is the code I'm using right now:

      off_drag1._x = -400;
      off_drag1._y = -400;
      off_drag2._x = -400;
      off_drag2._y = -400;
      off_drag3._x = -400;
      off_drag3._y = -400;
      off_drag4._x = -400;
      off_drag4._y = -400;
      off_drag5._x = -400;
      off_drag5._y = -400;

      I know this can be done with a for loop but I'm not sure how to change the
      name of the movie clip with each loop (off_drag1, off_drag2, off_drag3...).

      Can anybody please help?

      Thanks.

      CPG


        • 1. Re: Loop through clips
          kglad Adobe Community Professional & MVP
          :

          • 2. Re: Loop through clips
            Level 7
            Thanks kglad!

            Just one more question. In case I want to do the same with variables, would
            I be using the same syntax?

            For example here:

            mc_choices.drag1._x = mc_choices.drag1_x;
            mc_choices.drag1._y = mc_choices.drag1_y;
            mc_choices.drag2._x = mc_choices.drag2_x;
            mc_choices.drag2._y = mc_choices.drag2_y;
            mc_choices.drag3._x = mc_choices.drag3_x;
            mc_choices.drag3._y = mc_choices.drag3_y;

            (drag1, drag2, etc are clips)
            (drag1_x, drag1_y, etc are variables)

            Thanks

            CPG



            "kglad" <webforumsuser@macromedia.com> escribió en el mensaje
            news:fkra7n$m4a$1@forums.macromedia.com...
            > :
            >
            >
            >
            > for(var i=1;i<=5;i++){
            > this["off_drag"+i].x=-400;
            > this["off_drag"+i].y=-400;
            > }


            • 3. Re: Loop through clips
              kglad Adobe Community Professional & MVP
              you're welcome. and yes, you would use the same array notation for variables: