CreateJS:MovieClip.children在gotoAndStop()之后不会更新 [英] CreateJS : MovieClip.children doesn't update after gotoAndStop()

查看:223
本文介绍了CreateJS:MovieClip.children在gotoAndStop()之后不会更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CreateJS(2015.11.26)通过Animate CC(16.0.0.112)

CreateJS (2015.11.26) via Animate CC (16.0.0.112)

结构:

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);
});

结果是:

[Log] Button 0 : [MovieClip]
[Log] Button 1 : undefined

,当遍历 self.myContainer.children 时,仅 btn_0 存在。

所以在播放帧时,不会更新 self.myContainer.children

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.

非常感谢任何帮助。

(问题在这里提出: https://github.com/CreateJS/EaselJS/issues/848

推荐答案

我相信这是因为两个按钮都使用相同的符号。
在AnimateCC中,选择btn_1并通过交换复制到新符号来更改其实例。

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.

这对我来说是这样的:

Button 0 : [MovieClip (name=null)]
Button 1 : [MovieClip (name=null)]

这篇关于CreateJS:MovieClip.children在gotoAndStop()之后不会更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆