6 Replies Latest reply on Mar 4, 2011 9:33 AM by Ned Murphy

    pausing/waiting?? before moving on...

    d56_jones

      Hi i have a var amount of mc's which need to move across the screen which they do, but i need them at a noticeable speed which one can see!

      What is the correct pause/wait/time syntax required for my script? I guess it needs to be positioned in the "a" loop, to wait and then proceed etc...

      many thanks in advance...

       

      for (a=0; a<40; a++) Somehow pause / wait here for x fractions of second before continuing
              {for (loop_n2=0; loop_n2<number2; loop_n2++) {
              this["number2_mcs"+loop_n2]._x += 5;
              this["number2_mcs"+loop_n2]._y -= 5;}}

       

      Dee

        • 1. Re: pausing/waiting?? before moving on...
          Ned Murphy Adobe Community Professional & MVP

          You do not want to use a for loop... there is no pausing/slowing a loop.  What you want to do is introduce something like enterFrame processing.  In the timeline try using...

           

          this.onEnterFrame = function(){

               for (loop_n2=0; loop_n2<number2; loop_n2++) {
                    this["number2_mcs"+loop_n2]._x += 5;
                    this["number2_mcs"+loop_n2]._y -= 5;

               }

          }

          1 person found this helpful
          • 2. Re: pausing/waiting?? before moving on...
            d56_jones Level 1

            Thanks Ned, that helps a lot, but how do i get them to stop?

            My loop was within a loop of i think 40 moves, which stopped it before.

            Dee

            • 3. Re: pausing/waiting?? before moving on...
              d56_jones Level 1

              Got it to work, had brain failure before.

               

              this.onEnterFrame = function(){_root.times ++;
                  if (_root.times <= 40){
                  for(loop_n2=0; loop_n2<number2; loop_n2++) {
                        this["number2_mcs"+loop_n2]._x += 5;
                        this["number2_mcs"+loop_n2]._y -= 5;}}}

              • 4. Re: pausing/waiting?? before moving on...
                Ned Murphy Adobe Community Professional & MVP

                Yep, that'll do it, except you should also remove the enterFrame when it's done to stop the processing altogether.  Otherwise it will keep going, eating up processing resources.

                 

                 

                this.onEnterFrame = function(){

                    _root.times ++;
                    if (_root.times <= 40){
                         for(loop_n2=0; loop_n2<number2; loop_n2++) {
                               this["number2_mcs"+loop_n2]._x += 5;
                               this["number2_mcs"+loop_n2]._y -= 5;

                         }

                    } else {

                         delete this.onEnterFrame;

                    }

                }

                 

                 

                 

                 

                 

                 

                • 5. Re: pausing/waiting?? before moving on...
                  d56_jones Level 1

                  Ned. Thanks ever so much for your help. Constructive and helpful even if no doubt to yourself it was a simple task.

                  On another site i have tried, some people tend to be a little pompous in their answers,  I wonder why they bother to answer questions at all, (albeit in a belittling manner). Probably some ego thing.

                   

                  Once again, many thanks, until the next episode!

                   

                  Dee

                  • 6. Re: pausing/waiting?? before moving on...
                    Ned Murphy Adobe Community Professional & MVP

                    You're welcome.

                     

                    While I don't ever intend to come across as pompous, written communications can often cause words to be interpretted in unintended tones. Most often my responses are direct, without flowery introduction or friendly-pointed wording... which some people can interpet as being pompous or unfriendly... they want the WalMart greeting and the smiling "How can I help you" service.

                     

                    Sometimes a sensed tone gets a response in an intentional tone.  I know if I pick up a negative tone from a posting, I will often adapt a negative tone in my reply.  I'm human in that way, though I avoid personal attacks.  There are a couple of people I have dealt with that judged me negatively using various terms in the realm of ego, pompousity, arrogance, etc  as they left stomping their feet when they didn't get what they wanted.

                     

                    There are indeed some folks that carry a pompous or otherwise abusive demeanor in the way they treat folks.  I rarely see it here in the Adobe Flash forums... the folks that help here are all reasonably courteous.  There are other Adobe product forums where a few bad apples can be quite a chore... they seem to thrive on creating conflict.

                     

                    And there is one non-Adobe forum site that I won't name where ego has to be what guides the person/person(s) that run it all... even posted here one day looking for compensation from Adobe for supporting their products... sounded drunk ... proving that it's possible to sound drunk in writing.

                     

                    In all cases, just remember, you are dealing with people... no more, no less.

                     

                    (Now watch... one of my few nemeses will find this and lay into it)