如何将 FXG 导入形状?
我可以将 FXG 文件作为 Sprites 导入,如下所示:
import graphics.mypic; // graphics/mypic.fxg
var mysprite:Sprite = new mypic();
我并不总是需要 Sprites 附带的奇特东西。如何将它们导入到 Shapes 中?
I can import FXG files as Sprites as follows:
import graphics.mypic; // graphics/mypic.fxg
var mysprite:Sprite = new mypic();
I don't always need the fancy things that come with Sprites. How can I import them to Shapes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,您不能将它们转换为 Shape(s) - 内部编译时 FGX 构建在 Sprite 之上。你可以通过运行来发现
什么 George Profenza 指的是 FXG 的运行时加载
No, you can't cast them as Shape(s) - the internal compile-time FGX is built on top of Sprite. You can find that out by running
What George Profenza is referring to is runtime loading of FXG's
我不知道是否有更好的方法可以做到这一点,但是去年 我玩过一个不错的FXGParser 库大大简化了事情。
获取库:
svn 导出 http://www.libspark.org/svn/as3/FxgParser/
使用它:
导入fxgparser.FxgDisplay;
导入graphics.mypic;
var fxg:XML = new XML(mypic);//这部分取决于您如何加载/嵌入 fxg xml
var mysprite: FxgDisplay= new FxgDisplay( fxg );
addChild( mysprite );
祝你好运!
I don't know if there's a better way to do this know, but last year I've played with a nice FXGParser library that simplified things a lot.
Get the library:
svn export http://www.libspark.org/svn/as3/FxgParser/
Use it:
import fxgparser.FxgDisplay;
import graphics.mypic;
var fxg:XML = new XML(mypic);//this bit depends on how you load/embed the fxg xml
var mysprite: FxgDisplay= new FxgDisplay( fxg );
addChild( mysprite );
Goodluck!