如何在 jsfl 中访问影片剪辑的子级(特别是子级影片剪辑)?
我已经处于实例级别
flash.documents[0].timelines[0].layers[0].frames[0].elements[0].instance
我发现了本文档但仅此而已。
提前致谢。
在 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)
一开始这似乎违反直觉,但你很快就会习惯。最简单的思考方式是,基本上所有元素都是“顶级”,因为它们都位于库中。
此外, fl.getDocumentDOM().getTimeline() 是获取当前文档和时间线的常用方法。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)