flash - 使用 JSFL AS3 CS5.5 访问子/嵌套影片剪辑

标签 flash actionscript-3 flash-cs5 jsfl flash-cs5.5

如何在 jsfl 中访问影片剪辑的子级(特别是子级影片剪辑)?
我已经在实例级别从
flash.documents[0].timelines[0].layers[0].frames[0].elements[0].instance
我找到了 this documentation但没有太多其他的。
提前致谢。

最佳答案

在 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() 是获取当前文档和时间线的常用方法。

关于flash - 使用 JSFL AS3 CS5.5 访问子/嵌套影片剪辑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7520652/

相关文章:

javascript - 自定义 slider AS3 声音搜索

flash - AR 无人机 2 和 ffserver + ffmpeg 流

actionscript-3 - 删除as3中的空格

actionscript-3 - 如何在 flex 3 中将日期转换为字符串

actionscript-3 - 类型未找到或不是编译时常量 1046

actionscript-3 - AS3 : Exit desktop flash player

javascript - 这是什么效果

actionscript-3 - AS3 - 删除 StageText 字段的焦点

actionscript-3 - CS5 Flash 应用在本地运行时有声音,但在服务器中运行时静音

actionscript-3 - AS3向 Sprite 添加子元素会影响 Sprite 尺寸......很奇怪