1 Reply Latest reply on Oct 27, 2010 5:08 PM by Ned Murphy

    new Tween () in as 2.0


      Hello. Normally I use AS3 for all my coding needs ... however today I'm working for a customer that requires that I do their ad banners in AS2 so, I'm scratching my head on even the simple stuff ...


      I'm trying to do a dynamic tween that is triggered by the onRelease event. The end destination of the tween will be dynamiclly set each time the left or right arrow button is clicked ... what will happen is, a long movieClip filmstrip containing different images will scroll to the appropriate _x coordinate to align the correct image.  My trouble is with my syntax I think ... because Flash is completely blowing off the tween event.  If you look at the code below, the one line that I have commented out (//sectionsStrip_mc._x = endX_right;), that was just a temporary work around to see if everything else works.  It definitely does ... That is, If I leave out the tween all together and just update my _x property with new values, it works.  Now I 'd like to get it to animate with the Tween class.  The way I have it below, it just doesn't acknowledge the tween.  I'm wondering (even though I Googled it already) if maybe that tween statement construct that I have is exclusive to AS 3.0?


      Here's my code for the rightButton_mc.  There will also be a left button to move the filmstrip left, but I figured I could just get the rightButton_mc up and running first.


      //---determine "end" variable
      on (release) {
          if(sectionsStrip_mc._x == 0){
              endX_right = -450;
          } else if(sectionsStrip_mc._x == -450){
              endX_right = -900;
          } else if(sectionsStrip_mc._x == -900){
              endX_right = -1350;
          } else if(sectionsStrip_mc._x == -1350){
              endX_right = -1800;


      function filmTweenRight()
          //sectionsStrip_mc._x = endX_right;
          new Tween(sectionsStrip_mc, "_x", Regular, sectionsStrip_mc, endX_right, 1, true);



        • 1. Re: new Tween () in as 2.0
          Ned Murphy Adobe Community Professional & MVP

          Honest, you oughta get that code on the timeline and off the object.  There's a reason they don't allow that in AS3, as well as a reason they changed in AS2 to be something you can use on the timeline.  NEsting functions is never a good idea.  If you are familiar with AS3, placing the code on the timeline should be a walk in the park for you.


          The tween is probably not working because you are not importing it in the scope of where it is used, if at all.

          1 person found this helpful