Jump to content
Search Community

Removing an object after the end of a tween

Wodan test
Moderator Tag

Recommended Posts

Hi guys,

I'm new to tweenLite, and can say I'm pretty much amazed by the performance difference when compared to flash's native tween class.

however, being new, also means i'm trying to adapt my old codes to the new engine, so this is my problem:

 

using regular tween i had this:

tweenY = new Tween (ball, "scaleY", null,( ball.scaleY-0.5), 3.5, 5, true);

tweenY.addEventListener(TweenEvent.MOTION_FINISH, gotcha, false, 0, true)

so that when the tween ended it would call the "gotcha" function.

this function would in turn remove the tweened object with the following line:

if(e.target.obj.parent != null){removeChild(MovieClip(e.target.obj))};

 

having changed to tweenlite, I used the following:

 

grow= new TweenLite(bola, 5, {scaleX:3.5, scaleY:3.5, onComplete:gotcha});

and in the gotcha function:

 

removeChild(MovieClip(cresceBola.target))

but I'm getting :"ArgumentError: Error #1063: Argument count mismatch on defesa_new_fla::MainTimeline/gotcha(). Expected 0, got 1

any idea of what i could be doing wrong?

 

thanks in advance

Link to comment
Share on other sites

when using fl tween, your tween complete event handler should take 1 parameter, namely the TweenEvent.MOTION_FINISH event.

but using TweenLite, the tween complete event handler take 0 parameter by default. So you should give your gotcha function a default parameter.

however, you can also add an extra property to vars used by TweenLite, which is "onCompleteParams".

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