3 Replies Latest reply on Nov 21, 2007 6:13 PM by Newsgroup_User

    Tween class trouble

    Walter Elias Level 2
      I don't use Tween class often, so don't scold me if this is an obvious question.

      When I set up a simple Tween, it works if I assign a specific object's instance name as the object to tween. But when doing it inside a for loop, it doesn't work. Yet everything else within the for loop works. I've tested every variable, and it's the object name that doesn't work. Here is a simplified version of the code. Someone please tell me what I've done wrong.

        • 1. Re: Tween class trouble
          Level 7
          Walter,

          > When I set up a simple Tween, it works if I assign a specific
          > object's instance name as the object to tween. But when
          > doing it inside a for loop, it doesn't work.

          Interesting. Honestly, your code looks fine. I just copy/pasted,
          literally, and it worked as expected.

          I did notice one parameter that might cause some confusion. In this
          line:

          var letterUp:Tween = new Tween(this, "_x", Bounce.easeOut, this._x,
          this.startX, 2000);

          ... that last parameter, 2000, means the tween will progress *very* slowly,
          as it will transpire over the duration of 2000 frames. In a standard 12dps
          movie, the full tween would take over 166 seconds. I'm wondering if you
          meant 2000 in terms of milliseconds? For that, you could drop it to 2, and
          add one more parameter, true, to indicate you want the tween to transpire in
          terms of seconds (true), rather than frames.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Tween class trouble
            Walter Elias Level 2
            Oops. You were right. I was thinking milliseconds. Argh! AS2 is so full of inconsistencies. One of these days I may just buy Flash CS3 and start learning AS3. I assume it's a more consistent language.

            Thanks again.
            • 3. Re: Tween class trouble
              Level 7
              Walter,

              > One of these days I may just buy Flash CS3 and start
              > learning AS3. I assume it's a more consistent language.

              In many important ways, it really is more consistent. Have you checked
              out FlashDevelop?

              http://www.flashdevelop.org/community/

              Free open source scripting IDE for AS2 and AS3. It takes care of you
              the whole way ... even creates the SWF(s) for you. Obviously, there are no
              drawing tools, but for programming projects, it's a really neat app.


              David Stiller
              Adobe Community Expert
              Dev blog, http://www.quip.net/blog/
              "Luck is the residue of good design."