Jump to content
Search Community

Help with Error 1116: second argument to Function.prototype.

nchung test
Moderator Tag

Recommended Posts

I am using the following code to fade and remove all the children of an object:

 

var i:uint = this.numChildren;
		while (i--) 
		{
			var target:DisplayObject = getChildAt(i);
			TweenLite.to(target, 2, {alpha: 0, onComplete: removeThis, onCompleteParams: target});
		}

private function removeThis(target:DisplayObject)
	{
		removeChild(target);
	}

 

Everything fades out, but on the remove, I am getting the following error message, can anyone advise?

 

TypeError: Error #1116: second argument to Function.prototype.apply must be an array.
at Function/http://adobe.com/AS3/2006/builtin::apply()
at com.greensock.core::TweenCore/complete()
at com.greensock::TweenLite/renderTime()
at com.greensock.core::SimpleTimeline/renderTime()
at com.greensock::TweenLite$/updateAll()

Link to comment
Share on other sites

yeah, I think it is because completeParams: needs to be in the form of an array. right now you are passing in a displayObject.

 

do this

 

TweenLite.to(target, 2, {alpha: 0, onComplete: removeThis, onCompleteParams:[target]});

 

now you are passing an array with one item in it. the reason it expecting an array is because it allows you pass in multiple parameters when the need arises.

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