2 Replies Latest reply on Oct 20, 2009 8:56 AM by anyoneSeenMaiTai

    AS2 Tween Question

    anyoneSeenMaiTai

      I'm trying to trigger a timed tween event using AS2. I'm using the following:

       

      wipe._alpha = 0;
      var wipeFlag = Boolean(false);
      
      onEnterFrame = function() {
      if ((_root.elapsedTime > (_root.n - _root.fadeTime)) && (wipeFlag == false)) {
           new Tween (wipe, "_alpha", Regular.easeIn, 0, 100, fadeTime, true);
           wipeFlag = true;
      }
      }
      

       

      I must ramp the alpha level at a specific time. Can someone show me a better way to do this?

       

      Thanks!

        • 1. Re: AS2 Tween Question
          Ned Murphy Adobe Community Professional & MVP

          It's hard to tell you what might work better without knowing what defines a specific time.  If what you have in that conditional is a valid test for that specific time, then the only thing you might need to do is to delete the enterFrame as soon as the conditional passes... otherwise it will continuously trigger the tween

           


          this.onEnterFrame = function() {
          if ((_root.elapsedTime > (_root.n - _root.fadeTime)) && (wipeFlag == false)) {
               var tw = new Tween (wipe, "_alpha", Regular.easeIn, 0, 100, fadeTime, true);
               wipeFlag = true;

               delete this.onEnterFrame;
          }
          }

          • 2. Re: AS2 Tween Question
            anyoneSeenMaiTai Level 1

            Your assumption is correct. The timed event is triggered by the condition shown. I'll give this a try and report back.

             

            Thanks.