Skip to main content
Inspiring
August 18, 2009
Question

AS 3 Tween Class help

  • August 18, 2009
  • 1 reply
  • 800 views

I could really use some help. I'm using AS 3 and am creating a simple vertical menu where 6 buttons reside. When any of the buttons is clicked it takes you to specific frame label. On each frame label I have some actionscript that once arrived at will animate a small triangle along the y axis to rest next to the button the user has just clicked. I am trying to use the Tween Class to aminate the small triangle. Here is what I have so far:

import fl.transitions.Tween;
import fl.transitions.easing.*;

var arrowTween:Tween = new Tween(arrow_mc, "y", Regular.easeOut, 20, 80, 2, true);

The var created assigns the triangle a new end position. Here's where I need help. In the example above the 20 is the starting position and what I need is something that says whatever the current (this) position value is move to the desired end position value, which is 80 in the example.

I'm up late trying to figure this one out. Any help or ideas to lead me in the right direction is greatly appreciated.

This topic has been closed for replies.

1 reply

Craig Grummitt
Inspiring
August 18, 2009

i assume when you said '...whatever the current (this) position value is...' you actually meant 'whatever the current arrow_mc.y value is'

if so, easy. replace '20' with 'current arrow_mc.y':

var arrowTween:Tween = new Tween(arrow_mc, "y", Regular.easeOut, current arrow_mc.y, 80, 2, true);
necieAuthor
Inspiring
August 19, 2009

Craig,

Thanks for the help. I really appreciate it. However, I'm still having a bit of trouble. When I put in "current arrow_mc" I get syntax errors in the compiler errors box.

1084: Syntax error: expecting rightparen before arrow_mc.

Here is the code I have put in:

stop();

import fl.transitions.Tween;
import fl.transitions.easing.*;

var arrowTween:Tween = new Tween(arrow_mc, "y", Elastic.easeOut, current arrow_mc.y, 39.5, 1, true);

Any ideas?

Mike

Craig Grummitt
Inspiring
August 19, 2009

pff!! i pasted 'current' by mistake. remove the word 'current' you should be fine!