Thursday, November 20, 2008

Tweener Hidden Gem (_autoAlpha)... No more setting visible onComplete garbage

I just stumbled across _autoAlpha in the Tweener documentation. I was actually looking for something completely different but this caught my eye. Typically when I do a tween where the object needs to turn invisible afterwords I have to call an onComplete function to change the visibility or possibly just setup a second tween with a delay that sets the visibility to false.

_autoAlpha gets rid of the unnecessary bulkiness of those methods by simply hiding the item automatically when the alpha reaches 0. On the flip side it also makes objects visible when their alpha goes above 0.

Perfect!

3 comments:

Jason said...

FYI TweenLite (http://blog.greensock.com/tweenliteas3) also has this property available. For that matter, so does Grant Skinner's new tween class.

And I agree it is very handy ;-)

Ickydime said...

That is a good point. I just saw that this morning after a friend read my post and asked me why the hell am I still using Tweener instead of TweenLite/TweenMax/Gskinner...

Looks like I have some experimenting to do.

Lanny said...

gTween also supports this using an "autoHide" property.