4 Replies Latest reply on Sep 17, 2006 3:41 PM by ricklecoat

    Can't get Tween to work via AS

      From what I've read in the documentation (built-in and 3rd party) this should be simple enough, even if it does have a lot of arguments to keep track of. But I just can't get this rollover tween to work. On rollover, the target mc should grow a bit and move slightly up and left (so it gets bigger but stays more or less where it is). I originally did it without tweening just by changing the _x, _y, _xscale, and _yscale properties via the growClip function, and it worked fine -- so I know that the clipName variable is being defined correctly by the rollover event. But trying to 'nice' it up a bit with a tween has me ata loss. It simply doesn't work.

      Here's my code; if anyone can offer any assistance I'd be most grateful.
      Thanks in advance;

        • 1. Re: Can't get Tween to work via AS
          Peter Lorent Level 2
          The clipName contains the name of the movieclip and not the path to the movieclip which would be _level0.myClip_mc. Just pass 'this' to the growClip function. See attached code.

          • 2. Re: Can't get Tween to work via AS
            ricklecoat Level 1

            Thanks very much for your help. Not being particularly adept at Actionscript (yet) it took me a little while to follow through the logic of it, but if I understand your code correctly the clipName variable is not needed at all -- the target_mc argument makes it redundant as long as the target is set up by giving 'this' to the growClip function.

            Interesting stuff, although I'm sure it's completely basic -- the trouble with teaching yourself something as multi-layered as ActionScript is that you tend to learn it in piecemeal fashion and not with any logical progression. Anyway, one more snippet to add to my bucket of knowledge.

            One last thing: the mc instances are scaling from the top left corner (hence the necessity for the extra script to reposition them so that they stay 'in place' as the resize). Is there a way using ActionScript to get them to resize (Tweening) from their centre rather than the corner? This would let me do away with the repositioning code entirely and would also solve one or two other things that are bothering me.

            Can that be done?

            • 3. Can't get Tween to work via AS
              Peter Lorent Level 2
              The movieclip gets tweened from its registration point. Doubleclick the mc to edit in place. Examine the x and y in the property inspector -> in your case 0,0. Reposition the mc so that the registration point is in the middle of the mc -> if your square is 50x50 set x and y to -25. Go back to the main scene and reposition the mc to the original position. Now your square tweens from the center.
              • 4. Re: Can't get Tween to work via AS
                ricklecoat Level 1
                Wonderful, thanks LuigiL. I think I was getting my registration and transformation points confused. Also, I was looking for a way to reassign the registration point using AS rather than doing it in the timeline/stage. All is not working, thank you.