Open Jaswant99 opened 4 years ago
This was mentioned just recently in https://github.com/CreateJS/EaselJS/issues/1048#issuecomment-670836338
So... it sounds like it is not the right behavior to add the clip back again once it is removed.
Your proposed solution would be to set the _off property to true when removeChild() is used and set the _off property to false when the addChild() is used. I have made a test version of CreateJS here: https://zimjs.org/cdn/1.3.3/createjs_doc_off.js
The three changes in it can be found by searching: https://github.com/CreateJS/EaselJS/issues/1038
If you could test it and see if it works, that would be great. If not, then I will set up tests here, etc. Just going out for a swim! (hahaha - funny, the issue is from December and I am hoping for a test by the time I get back from swimming eight months later - I am so used to fixing bugs with developers as soon as they report them.)
Issue Details
if a Tween is added to some timeline on some target. tween = cjs.Tween.get(target); timeline.addTween(tween.wait(1));
if target is an instance of createjs.DisplayObject then in below mentioned
_resolveState
function(MovieClip.js)_addManagedChild
(MovieClip.js) adds that target as a child to owner of the timeline.Consider
this.removeChild(target)
is called and target is removed from parent but child is still there because on next tick target again gets added as child in _resolveState function and it looks like removeChild didn't work.Mac 10.15.1 Chrome 78.0.3904.108
Possible solution: setting child._off = true on removing child and setting false on adding child.
this.removeChild(target);
target._off = true;
this could be done either outside createjs or can be made part of removeChild and addChild functions.
Is this ok or is there any other solution or any other approach to solve this problem?
https://jsfiddle.net/jaswant0709/mocqfj3s/17/