-
removeChild after tweenlite not really working
Hello folks,
I'd like to remove objects via removeChild after Tweenlite has finished tweening. But it doesn't really work because my objects are still in the DisplayList. I can't figure out the problem so I would be very happy if someone could help me out with this problem. Thanks in advance.
Code:
//TweenLite.to(sndText, .5, {alpha:0, onComplete:removeChild, onCompleteParams:[sndText]});//does not really work; still in DisplayList
TweenLite.to(sndText, .5, {alpha:0});
TweenLite.to(musicText, .5, {alpha:0});
TweenLite.to(sndSlider, .5, {alpha:0});
TweenLite.to(musicSlider, .5, {alpha:0});
TweenLite.to(okBtn, .5, {alpha:0});
TweenLite.to(sndMinus, .5, {alpha:0});
TweenLite.to(sndPlus, .5, {alpha:0});
TweenLite.to(musicMinus, .5, {alpha:0});
TweenLite.to(musicPlus, .5, {alpha:0, onComplete:removeSettings});
//removeChild(sndText); //this works but I don't know why
Code:
override public function removeSettings():void {
//removeChild doesn't really work (still in DisplayList)
removeChild(sndText);
removeChild(musicText);
removeChild(sndSlider);
removeChild(musicSlider);
removeChild(okBtn);
removeChild(sndMinus);
removeChild(sndPlus);
removeChild(musicMinus);
removeChild(musicPlus);
}
-
maybe pass your display objects in an array to the removeSettings function?
TweenLite.to(musicPlus, .5, {alpha:0, onComplete:removeSettings, onCompleteParams:new Array(remove me)});
override public function removeSettings(e:*):void {
removeChild(e);
}
-
//TweenLite.to(sndText, .5, {alpha:0, onComplete:removeChild, onCompleteParams:[sndText]});
This line of code should work. Are you getting any error messages? Are the objects you are removing on the stage?
-
I've had several problems with tweenlite. One is probably the one you have.
While it's tweening, you can't properly access the item being moved, and after it's done tweening, in alot of cases you can't access immediately either. So to solve this problem in one of my projects I had to add a timer of 3 secs after it was finished tweening. So to be sure to be able to do whatever you want with it after it's done tweening, wait 2-3 secs before doing anything with the item that was in motion.
So, after it has stopped, it's for some reason still in use for some additional time.
Last edited by TenchyCho; 10-19-2011 at 01:32 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|