3 Replies Latest reply on Oct 28, 2009 4:40 PM by Ned Murphy

    Using onEnterFrame, movie clips, and timeline

    eholz1 Level 1

      Hello Members,

       

      I have been digging around the AS 2 forum for some guidance on using the onEnterFrame function.

      I have not quite found my answer.  It seems that in general, it is not a good idea to use a frame number (or numbers)

      for running tweens.

       

      I would like to use onEnterFrame (unless it would be a bad practice) to tween letters (the letters are movieclips).

       

      for example:

       

      var frame: Number;

       

      this.onEnterFrame = function() {

           frame = this_currentframe;

       

           if (frame == 30)

           {

               //tween this letter

           }

       

           if (frame == 60)

           {

              //tween the next letter

           }

       

           if (frame > 90)

           {

              delete this.onEnterFrame;

           }

      }

       

      I am attaching the movieclips to the stage at different levels.  I have no frames set in the timeline (like a keyframe at 1, and a keyframe at 91).

       

      When this function runs it never gets out of frame 1.  If I put keyframes on the timeline from 1 to 90, then it plays.  Is there a way to not have to create a timeline in the editor with a 90 frame span??

       

      I have a feeling I am missing something basic about using actionscript vs. the timeline for tweens, etc.

       

      Thanks,

       

      eholz1