[Tweener] Noob Question: Animate Instances Only?

Zeh Fernando zeh at zehfernando.com
Sun Aug 10 13:26:09 PDT 2008


> I'm still learning AS3 and Tweener at the same time so please excuse me 
> if my terminology is off but hopefully you get what I'm trying to ask.
> I'm trying to create a class for disabling an animation and I'd like to 
> know how to animate something without having to use the instance name. I 
> know the description of Tweener says that it animates instances but is 
> there a way to do this dynamically so I don't have to type in the 
> instance names all the time?

I'm not really sure I get the question - Tweener would have to know what 
to animate, so you need to use the instance name as the reference.

If you're trying to animate the same display object, you can just use 
"this" as the reference parameter since you're inside the object already.

If it's a child of the current display object or something that's 
somewhere else, you'd indeed need to use the name, or if you want to do 
that in a more painful way, you could use getChildAt().

   // Animates whatever's at level 0
   Tweener.addTween(getChildAt(0), {...});

Or you could always have an array of objects too...

   var myobjs:Array = [cube, sphere, pyramid];
   // Animates "cube"
   Tweener.addTween(myobjs[0], {...});


HTH,
Zeh


More information about the Tweener mailing list