Flex 或 Actionscript 从外部 Illustrator SWF 访问内容
我在访问 Illustrator SWF 中的内容时遇到问题(我使用 illustrator 创建 swf,导出并将图层另存为符号)。 当我使用 flash 创建 swf 文件时,我可以使用此代码访问形状和符号。
我正在尝试获取并更改 swf 文件中符号的颜色,
var flashMovie:Sprite = this.content as Sprite;
for (var i:int = 0; i < flashMovie.numChildren; i++)
{
flashMovie.getChildAt(i).name;
flashMovie.getChildAt(i).transform.colorTransform.color;
}
但是当我使用 Illustrator 创建 swf 文件时,它不返回任何内容。
如何访问 Illustrator SWF 的内容并更改其颜色
I have problem accessing content from an Illustrator SWF(I create the swf using illustrator, I export I Save layers as symbols).
When I create my swf file using flash i can access shapes and symbols using this code.
I am trying to get and change the color of a symbols in my swf file
var flashMovie:Sprite = this.content as Sprite;
for (var i:int = 0; i < flashMovie.numChildren; i++)
{
flashMovie.getChildAt(i).name;
flashMovie.getChildAt(i).transform.colorTransform.color;
}
But when I create my swf file using Illustrator it return nothing.
How can can i access the content and change the color of an Illustrator SWF
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是否可以使用 Illustrator 导出 AVM2 (AS 3) swf?如果我错了,请纠正我,但据我所知,Illustrator CS5 仍然导出 AVM1 (AS 1 & 2) swf。在 AS3 项目中,所有加载的 AS2 电影均由 flash.display.AVM1Movie 类表示。该类没有显示链子级,它只是一个显示渲染的 AVM1 剪辑的 DisplayObject。由此可见,您无法访问 Illustrator 定义的任何符号。
我不太确定是否可以使用 call() 方法来调用 AVM1Movie 中的某些方法。是否可以在 Illustrator 中添加 AS2 方法?可能不是...
您可以将每个元素导出为单个 swf,或者选择其他导出格式,例如 svg。
Is it possible to export AVM2 (AS 3) swf's using Illustrator? Correct me if i am wrong, but as far as I know Illustrator CS5 still exports AVM1 (AS 1 & 2) swf's. Within a AS3 Project all loaded AS2 Movies are represented by the flash.display.AVM1Movie class. This class has no display-chain children, it is just a DisplayObject showing the rendered AVM1 Clip. From this it follows that you can't access any symbols defined by Illustrator.
I am not quite sure if you can use the call() Method to invoke some Method within a AVM1Movie. Is it possible to add AS2 methods within Illustrator? Probably not...
You can either export every element as single swf, or choose some other export format such as svg.
最好的选择是将对象从 Illustrator 复制/粘贴到 Flash CS。这样,矢量对象就可以作为 AS3 Shape 对象移植。您还可以将它们拆分为不同的符号等...
Your best bet is to Copy/Paste your objects from Illustrator to Flash CS. That way vector objects may be ported over as AS3 Shape objects. You can also split them to different Symbols etc...