Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Change Tween Duration

Engaged ,
Apr 03, 2014 Apr 03, 2014

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.

TOPICS
ActionScript
440
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 03, 2014 Apr 03, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 03, 2014 Apr 03, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2014 Apr 04, 2014
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines