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

发布于 2024-12-06 02:04:43 字数 252 浏览 2 评论 0原文

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

How can I access a movie clip's children (specifically child movie clips) in jsfl?
I am already at the instance level from
flash.documents[0].timelines[0].layers[0].frames[0].elements[0].instance
I've found this documentation but not much else.
Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

帝王念 2024-12-13 02:04:43

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

The thing to remember in JSFL is that elements on stage are also items in the library, so it doesn't matter how many times you have something nested, it's still a clip in the library, and often that's the thing you want to work from.

In your case it would be:

// 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)

It does seem counter-intuitive at first, but you soon get used to it. The easiest way to think about it is that essentially all elements are "top level" as they all live in the library.

Also, fl.getDocumentDOM().getTimeline() is the usual way to get the current document & timeline.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文