6 Replies Latest reply on Mar 27, 2010 7:33 PM by Ned Murphy

    Two-dimensional time-line?

    xhdreamlover-VT8xt5

      hi, everybody:

       

      There are two frames in the time-line: frame 1 has a static movie clip naming "mcRect" in which a rectangle was drawn, and frame 2 has something different with frame 1.

      I put some scripts on frame1, as bellow:

       

      // --- my script begin ------------------------------------------

       

      stop();

       

      var i: Number = 0;

      this.onEnterFramw = function()

      {

           mcRect._x = mcRect._y = ++i;

      };

       

      // --- my script end --------------------------------------------

       

       

      When i test the movie, it stop at frame 1 as expected, mean that the time-line has been halted.

      But the movie clip "mcRect" namely the rectangle keep moving down-right with the frame rate, this like there has another time-line which is perpendicular to the main time-line.

       

      Is this guess right ?

      Does anybody knows the inside detail of the time-line concept?

        • 1. Re: Two-dimensional time-line?
          Ned Murphy Adobe Community Professional & MVP

          There is no second timeline.  The timeline is stopped and the onEnterFrame code you placed in frame one is continuously executing because that is the nature of the onEnterFrane event... it continuously fires at the frame rate of the file, as though it were continuously entering frame 1 over and over again.  The code is what is making the object move, by increasing its _x and _y properties with each enterframe cycle.

          1 person found this helpful
          • 2. Re: Two-dimensional time-line?
            xhdreamlover-VT8xt5 Level 1

            Now my idea is like this: there necessarily has an engine, a timer for example, which drive the animation to go ahead. And the motive power of the engine is divided into two branch: the first is used to make the play-head moving forward on the time-line, and the other used to generate the "enter frame" event.

            What functions like MovieClip.stop(), MovieClip.play(), etc controls is the first branch, not the second.


            i changed the script that i posted above as bellow:

             

             

            // --- my script begin ------------------------------------------

             

            stop();

             

            var i: Number = 0;

            this.onEnterFramw = function()

            {

                 mcRect._x = mcRect._y = ++i;

            };

             

            mcRect._x = mcRect._y = 100; // This line is my newly add.

             

            // --- my script end --------------------------------------------

             

            But its effect looked the same as its before - moving down-right with the frame rate, which means that the newly added line "mcRect._x = mcRect._y = 100;" had not been executed. So the fact is not "entering frame 1 over and over again". What about your opinion?

            • 3. Re: Two-dimensional time-line?
              Ned Murphy Adobe Community Professional & MVP

              It is behaving as I told you.  Your definition of what happens during the enterframe is defined in the function...

               

               

              this.onEnterFrame = function()

              {

                   mcRect._x = mcRect._y = ++i;

              };

               

              The line you added is outside of that function so it will not execute more than once.

              • 4. Re: Two-dimensional time-line?
                xhdreamlover-VT8xt5 Level 1

                 

                The outside code would be executed when the frame1 is entered, now that it's only be executed once, frame 1 won't be entered over and over agin, right?

                 

                • 6. Re: Two-dimensional time-line?
                  Ned Murphy Adobe Community Professional & MVP

                  The enterframe event "acts" like it is continuously entering the frame, but it is not actually continuously entering the frame.  Only the code designated to be run in the onEnterFrame function will execute continuously.

                  1 person found this helpful