0

我正在使用 adobe flash cs5,所以

mainTimeline -> {

 child1 movieclip ->{

  //i want from here to get parent.child2, but i get an error that there are no child2

 }

 child2 movieclip ->{

 }

}

我已经为 child2 电影剪辑添加了一个名称并将其导出到 actionscript,我也尝试过 stage.child2 - 但他没有看到它,我不知道可能是什么原因..

4

1 回答 1

1

如果子影片剪辑在时间轴上“彼此相邻”,那么尝试一下如何:

child1.parent.child2

或许

(child1.parent).child2

其背后的逻辑是 child1.parent 应该是对时间线的引用,然后可以访问 child2。

但是,如果您经常需要这样做,那么将 child2 的引用传递给 child1 或重组您的代码以避免这种情况可能是值得的。这样会减少“盲目依赖”或“通过时间线搜索”,并且可能不太容易损坏。将来编辑也可能更清晰。

于 2013-03-06T10:03:09.257 回答