Bri*_*eat 4 flash actionscript-3 jsfl flash-cs5 flash-cs5.5
如何在jsfl中访问影片剪辑的子代(特别是子影片剪辑)?我已经在flash.documents [0] .timelines [0] .layers [0] .frames [0] .elements [0] .instance的实例级别.我找到了这个文档,但没有其他的.提前致谢.
Dav*_*art 14
在JSFL中要记住的事情是,舞台上的元素也是库中的项目,所以嵌套有多少次并不重要,它仍然是库中的一个剪辑,通常这就是你想要工作的东西.
在你的情况下,它将是:
// break up your previous path to illustrate the "timeline" point
var timeline = flash.documents[0].timelines[0];
// grab the element
var element = timeline.layers[0].frames[0].elements[0];
// get its associated library item (same instance, just a Library Item, not a stage Element)
var item = element.libraryItem;
// then grab the library item's "timeline" property
var childTimeline = item.timeline
// and you can now access any "nested" elements on it
trace(childTimeline.layers[0].frames[0].elements)
Run Code Online (Sandbox Code Playgroud)
起初看起来似乎反直觉,但你很快就习惯了.最简单的思考方式是,基本上所有元素都是"顶级",因为它们都存在于库中.
此外,fl.getDocumentDOM().getTimeline()是获取当前文档和时间轴的常用方法.
| 归档时间: |
|
| 查看次数: |
6657 次 |
| 最近记录: |