我可以通过 Flex SDK 对嵌入式 SWF 资源使用时间线脚本吗?
我已使用类定义上方的语法将 SWF 嵌入到类中:
[嵌入(源='/../assets/MyMovieClips.swf',符号='SpecialMovieClip')]
公共类 SpecialMovieClip 扩展了 MovieClip MovieClip
资源似乎与我的类链接正常,并与其一起实例化,并且可见,但是:
- 我无法访问该剪辑中放置在舞台上的实例。
- 时间线脚本似乎不起作用。
这是使用 Flex SDK 在编译时嵌入 SWF 文件的缺点吗? 那么,如果我想要时间轴脚本或实例位于舞台上,也许我应该返回使用 Flash IDE 进行编译?
I've embedded a SWF into a class using this syntax above my class definition:
[Embed (source='/../assets/MyMovieClips.swf', symbol='SpecialMovieClip')]
public class SpecialMovieClip extends MovieClip
The MovieClip asset seems linked with my class okay, and instantiates along with it, and is visible, but:
- I can't access instances placed on stage within that clip.
- The timeline scripting seems non-functional.
Is this the drawback of embedding SWF files at compile-time with the Flex SDK?
So, maybe I should just go back to compiling with the Flash IDE if I want timeline scripting or instances positioned on-stage?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 [Embed] 标签进行嵌入,则所有脚本都将从您的符号中删除。
但是您可以使用 MovieClip.addFrameScript() 将脚本添加到帧中:
公共函数SpecialMovieClip(){
addFrameScript(4,myfunc)
}
私有函数 myfunc(){
停止()
}
我认为您只能访问 a 中的符号movieClip 与 movieClip.GetChildAt()
if you embed with the [Embed ] tag all scripts will be stripped from you symbol.
But you can add script to frames with MovieClip.addFrameScript():
public function SpecialMovieClip(){
addFrameScript(4,myfunc)
}
private function myfunc(){
stop()
}
i think you can only access the symbols inside a movieClip with movieClip.GetChildAt()
从文档:(向下滚动到“嵌入 SWF 符号”)
根据您想要执行的操作,我认为您最好嵌入整个 SWF,或者在运行时加载内容。
顺便说一句,关于无法访问嵌入符号中的内容,您是否确定目标 SWF 是 AS3?如果您要嵌入(或加载)AS2 内容,则仅允许通过 LocalConnection 实现互操作性。我链接的文档页面上也介绍了这一点。
From the docs: (scroll down to "Embedding SWF Symbols")
Depending on what you want to do, I think you'd be better off embedding the entire SWF, or loading things in at runtime.
Incidentally, regarding not being able to access stuff within the embedded symbol, did you make sure that the target SWF is AS3? If you're embedding (or loading) AS2 content, then interoperability is only allowed through LocalConnection. This is also covered on the doc page I linked.