CreateJS (2015.11.26) via Animate CC (16.0.0.112)
Structure :
root
- myContainer
- frame 0 -> btn_0
- frame 1 -> btn_1
First frame of root contains following code :
var self = this;
createjs.Ticker.addEventListener("tick", initScreen);
function initScreen() {
createjs.Ticker.removeEventListener("tick", initScreen);
self.myContainer.gotoAndStop(1);
}
this.myContainer.addEventListener("click", function(e) {
console.log("Button 0 : "+self.myContainer.btn_0);
console.log("Button 1 : "+self.myContainer.btn_1);
});
The result is :
[Log] Button 0 : [MovieClip]
[Log] Button 1 : undefined
And when iterating through self.myContainer.children
, only btn_0
exists.
So self.myContainer.children
is not being updated when playing through the frames.
Seems like a bug, as I can't find any documentation around this... but I'm surprised that I can't find anyone else who's had this issue.
Any help much appreciated.
(Issue raised here : https://github.com/CreateJS/EaselJS/issues/848)
I believe this is because both buttons use the same symbol. In AnimateCC, choose btn_1 and change its "instance of", by swapping-duplicating to a new symbol.
This logged for me: