Skip to main content
campbellma
Inspiring
April 3, 2014
Question

Change Tween Duration

  • April 3, 2014
  • 1 reply
  • 484 views

I have Actionscript tween and I am using a variable to control duration of the tween and want tot change that variable during a button function that takes place after the tween, but it doesnt change. Is there a way to change a tween property after its already run?

var tweenDelay=16;

var btnTween:Tween = new Tween(oneBtn_mc, "y", Strong.easeInOut, oneBtn_mc.y, 334.95, tweenDelay, false);

I am runing a button function that plays the tween to animate some buttons on with tween.start(); and then I am using tween.yoyo(); to reverse it when the button is pressed again. But they animate to close to each other so I need to offset it. On the second push I have the variable tweenDelay=10, but when I did a trace(btnTween.duration), and it stays 16.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
April 3, 2014

once btnTween executes what difference would it make to change tweenDelay (which is a misnomer - it's really tweenDuration);

any way, use a 3rd party tween class like tweenlite that allows the use of a delay parameter.  google: tweenlite as3 greensocks.

campbellma
Inspiring
April 3, 2014

The name of var doesnt matter I didnt think I just called it tweenDelay because it shorter, and it works. I was wondering if there was a way to change it. Can I use a event listerner like TweenEvent.MOTION_CHANGE or something.

kglad
Community Expert
Community Expert
April 4, 2014

yes, you can change it. but again, it won't make any difference once the tween code executes.