AS3& Swfmill:如何访问 swfmill 生成的库 swf 中的资源

发布于 2024-08-10 10:30:46 字数 1129 浏览 2 评论 0原文

我以这种方式在 as3 中创建库 swf,工作起来就像一个魅力(除了缓慢的 mxmlc 编译器):

package {
 import flash.display.Sprite; 
 public class Library extends Sprite {
   [Embed(source="assets/test.png")]
      public var TestBitmap:Class; 
 }
}

我想使用 swfmill 创建相同类型的库。我尝试过以下 swmfill 简单 xml:

<movie version="10">

检查 FlashDeveloper 的资源管理器中的库后发现,as3 库同时导出类和符号,但 swfmill 库仅导出符号。 我的主机应用程序正在以这种方式访问​​ as3 库资源:

private var loader:Loader = new Loader();

private function onCreationComplete():void {
    this.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
}

private function onComplete(e:Event):void {
    var resourceClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("Library") as Class;
    var resources:Object=new resourceClass();
    var testBitmapClass:Class = resources['TestBitmap'] as Class;   
    var testBitmap:Bitmap = new testPngClass();
    this.addChild(testBitmap);
}

但是由于没有导出的 swfmill 类,显然没有什么可以实例化的...

swfmill 是否期望以这种方式导出类?如果没有,是否有一种方法可以访问符号而不将它们实例化为类?

乔纳斯

I'm creating library swfs in as3 this way, works like a charm (except for the slow mxmlc compiler):

package {
 import flash.display.Sprite; 
 public class Library extends Sprite {
   [Embed(source="assets/test.png")]
      public var TestBitmap:Class; 
 }
}

I would like to create the same kind of libary using swfmill. I've tried the following swmfill simple xml:

<movie version="10">

Examining the libraries in FlashDeveloper's explorer reveals that the as3 library exports BOTH classes and symbols, but the swfmill library exports ONLY symbols.
My host application is accessing the as3 library assets this way:

private var loader:Loader = new Loader();

private function onCreationComplete():void {
    this.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
}

private function onComplete(e:Event):void {
    var resourceClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("Library") as Class;
    var resources:Object=new resourceClass();
    var testBitmapClass:Class = resources['TestBitmap'] as Class;   
    var testBitmap:Bitmap = new testPngClass();
    this.addChild(testBitmap);
}

But with no exported swfmill classes, there's obviously nothing to instatiate...

Is swfmill expected to export classes this way? If not, is there a way of accessing the symbols without instantiating them as classes?

Jonas

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

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

发布评论

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

评论(1

濫情▎り 2024-08-17 10:30:46

简而言之,不。我也一直在研究这个问题。由于我使用 Flash IDE、Haxe 和 flex,因此我将概述通过将内容嵌入到 swf 中来访问内容的不同方法。

看起来没有办法直接实例化符号。如果您的资源是由 Flash IDE 导出的,通常您会设置要导出的属性,以便 Actionscript 获取符号。在 Haxe 中,您需要指定一个类来匹配 swfmill xml 中的类。使用 Flex,您可以定义一个类并使用嵌入元数据标记通过嵌入 swf 来访问符号。 http://livedocs.adobe.com/flex/ 3/html/help.html?content=embed_4.html

该脚本可能对您生成导出类有所帮助。 http://wiki.disemia.com/HaXe_SWFMILL_Resource_Converter

如果您使用的是 AS3,您可能会如果您从命令行编译项目,则无论如何都必须使用 mxmlc。由于速度对您来说是个问题,因此您应该考虑使用 fcsh。

In short, no. I've been looking into this as well. Since I work with the Flash IDE, Haxe, and flex I'll outline the different methods for accessing content by embedding it in a swf.

It doesn't look like there's a way to directly instantiate a symbol. If your assets were exported by the Flash IDE, normally you would set the properties to export for Actionscript to get at the symbol. In Haxe you'd specify a class to match that in the swfmill xml. With flex you'd define a class and use the Embed metadata tag to access the symbol by embedding the swf. http://livedocs.adobe.com/flex/3/html/help.html?content=embed_4.html

This script which might be helpful to you for generating the export classes. http://wiki.disemia.com/HaXe_SWFMILL_Resource_Converter

If you're using AS3, you'll probably have to use mxmlc anyway if you're compiling your project from the command line. Since speed is the issue for you, you should consider using fcsh.

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