Jump to content
Search Community

Equivalent MOTION_CHANGE

Sister Ray test
Moderator Tag

Recommended Posts

Hello

 

I found a class on the net that I'm using but because it is written in Adobe Flash it is using the basic tween.

There is this eventlistener.

myTween.addEventListener(TweenEvent.MOTION_CHANGE, function);

I'm wondering what the equivalent of MOTION_CHANGE for TweenLite/Max.

 

Thanks!

Link to comment
Share on other sites

using TweenLite you can add an onUpdate callback function to your tween like so:

 

TweenLite.to(mc, 1, {x:100, onUpdate:updateFunction});

 

function updateFunction(){

trace("i'm moving");

}

 

read more here:

http://www.greensock.com/as/docs/tween/ ... nLite.html

 

using TweenMax you can use the callback OR a standard as3 eventListener like so:

 

import com.greensock.*

import com.greensock.events.TweenEvent;

 

var tweenMc:TweenMax = TweenMax.to(mc, 5, {x:600});

 

tweenMc.addEventListener(TweenEvent.UPDATE, updateFunc)

 

function updateFunc(e:TweenEvent):void{

trace("update " + mc.x);

if(mc.x>300){

trace("update done");

tweenMc.removeEventListener(TweenEvent.UPDATE, updateFunc);

}

}[/code]

 

for a list of all the callbacks and events read here:

 

http://www.greensock.com/as/docs/tween/ ... enMax.html

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...