使用 JSFL AS3 CS5.5 访问子/嵌套影片剪辑 [英] Accessing child/nested movie clips with JSFL AS3 CS5.5

查看:25
本文介绍了使用 JSFL AS3 CS5.5 访问子/嵌套影片剪辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 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.

推荐答案

在 JSFL 中要记住的一点是,舞台上的元素也是库中的项目,因此无论嵌套多少次都无所谓,它是仍然是库中的剪辑,通常这就是您想要使用的内容.

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.

在你的情况下是:

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

此外,fl.getDocumentDOM().getTimeline() 是获取当前文档的常用方法 &时间线.

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

这篇关于使用 JSFL AS3 CS5.5 访问子/嵌套影片剪辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆