Saturday 30 May 2009

Tweens in Flex

I came across a problem I've had before with Flex yesterday. Sometimes Tweens (and anything that relies on a Tween such as a Move or a Resize) just doesn't work. You call play() but you don't get any events from the Tween, not even a tweenStart event.

On another project I had this problem and had to write my own Tween which I called WorkingTween. I had to re-implement it yesterday.

I think it is a better implementation anyway as it just uses event listeners, you don't have to supply a listener object and you don't have to implement tweenUpdate and tweenEnd method (which you have to make public when using Tween).

My Tween you supply a startValue, endValue, duration and optionally interval and easingFunction. You then add listeners to the standard TweenEvent - tweenStart, tweenUpdate and tweenEnd.

Has anyone else had trouble with the standard Tween?

1 comment:

  1. Oh man.. Flex tweens are a pain in the ass for me :(
    I used to use AS2 Tweens a lot, and the AS3 Tweens in Flash CS3 are probably similar.
    But Flex just makes me crazy. I really cant get the most basic stuff done.
    For alpha tween, i use the fade effect alright.
    But I just cant get a tween on some custom property to work (for example on saturation or brightness of my custom image class)