Jump to content
Search Community

TweenMax onComplete()

halilc.1992 test
Moderator Tag

Recommended Posts

Hello everyone :)

 

I wonder something about TweenMax, onComplete function.

 

Normally when i use onComplete function its working just perfect but when i try to send a value like a movieclip, onComplete function starting with TweenMax.

 

 

Here is my code : 


import flash.events.MouseEvent;
import com.greensock.*;
import com.greensock.easing.*;

for(var i:int= 0;i<5;i++)
{
	this["k"+i.toString()].buttonMode = true;
	this["k"+i.toString()].addEventListener(MouseEvent.CLICK, sendMyMC);
}


function sendMyMC(e:MouseEvent)
{
	TweenMax.to(e.currentTarget,1,{x:400,ease:Back.easeOut,onComplete:KillMC(e.currentTarget.name)});	
}

function KillMC(name:String)
{
	removeChild(this[mc]);
}

In this code I want tween first then removeChild but it just remove my mc on stage and i cant see that Tween :/

Link to comment
Share on other sites

you need to use onCompleteParams separately

function sendMyMC(e:MouseEvent)
{
TweenMax.to(e.currentTarget,1,{x:400,ease:Back.easeOut,onComplete:KillMC, onCompleteParams:[e.currentTarget.name]}); 
}


function KillMC(name:String)
{
trace(name);
//removeChild(this[mc]);
}
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...