Share Posted February 8, 2011 I have the following code: 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); } I get the error message: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. However when I write this instead: var i:uint = this.numChildren; while (i--) { removeChild(getChildAt(i)); } My error is gone...but then so is my tween. What am I doing incorrectly? Link to comment Share on other sites More sharing options...
Share Posted February 8, 2011 i slammed this var i:uint = this.numChildren; while (i--) { var target:DisplayObject = getChildAt(i); TweenLite.to(target, 1, {alpha: .5, onComplete: removeThis, onCompleteParams: [target]}); } function removeThis(target:DisplayObject) { removeChild(target); } directly into a flash cs4 fla with 3 MovieClips on the stage. it worked flawlessly. each clip faded to .5 and then got removed. There is nothing inherently wrong with the guts of what you are doing or with TweenLite. I'm a bit confused myself. Perhaps there is something wrong with your class structure, but I really have no idea. Hopefully someone else can chime in. If you happen to solve it, please let us know. oh... maybe a this.removeChild... Carl Link to comment Share on other sites More sharing options...
Author Share Posted February 8, 2011 That helps SO much, thanks! It turned out I had another Tween in another class that wasn't removing items properly. So It was my class structure, but I wouldn't have found it without help...thanks! Link to comment Share on other sites More sharing options...
Share Posted February 8, 2011 i love it when a plan comes together. glad to help c Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now