Jump to content
Search Community

allTo - Getting attributes from the currently Tweened Obj

neuralism test
Moderator Tag

Recommended Posts

Hi Folks,

 

is there a way to access attributes on the object that is currently being (or about to be?) Tweened using Tweenmax.allTo?

 

import com.greensock.*;

var instanceList:Array = new Array(instance0, instance1, instance2);

TweenMax.allTo(instanceList, 0.5, { x: -(instanceList[n].width), y: -(instanceList[n].height) }, 0.1);

 

hoping to find out if there is anything like evt.currentTarget from those addEventListener methods?

 

alternatively I would do

import com.greensock.*;

var instanceList:Array = new Array(instance0, instance1, instance2);

for (var i:* in intanceList)
{
TweenLite.to(instanceList[i], 0.5, { x: -(instanceList[i].width), y: -(instanceList[i].height), delay: 0.05 });
}

 

But I'm just looking for possibilities on the former.

 

Thanks!

Link to comment
Share on other sites

Hello Neuralism,

 

Take a look at this:

 

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.events.TweenEvent;


var flashLetters:Array = new Array(
						  f_mc,
						  l_mc,
						  a_mc,
						  s_mc,
						  h_mc
						 );

TweenMax.allTo(flashLetters, 1, {rotationX:90,  onCompleteListener:myListener}, .05);

function myListener(event:TweenEvent):void {
   trace("completed tween of " + event.target.target.name);
TweenMax.to(event.target.target, 0, {alpha:0});


}

 

So the allTo starts the staggered rotation of each mc.

When each one completes, myListener knows exactly who each clip is via event.target.target.

Right now each mc is getting its alpha set to 0 when its tween is done.

You can grab any property of the currently tweened clip you want when that event fires.

 

You can also use onStartListener, and onUpdateListener and others http://www.greensock.com/as/docs/tween/ ... enMax.html

 

also, be sure to import com.greensock.events.TweenEvent as shown above.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...