在过去,有一个简单的技巧 ,通过mxmlc下行添加到flash-cs4 makefile来包含flex mxmlc模块:
-include-libraries “/absolute/path/to/my/assets/assets.swc”这使您能够使用getDefinitionByName ,一个帮助函数来访问嵌入式swc资产库(而不是创建手写类的所有资产)。
不幸的是,自flash-cs4以来,这已停止工作。 有人知道另一种解决方案吗?
In the past, there was a simple trick, to include the flex mxmlc module by adding the following line to the flash-cs4 makefile:
-include-libraries “/absolute/path/to/my/assets/assets.swc”This gave you the ability to use getDefinitionByName, an helper function to access the embedded swc asset-library (instead of creating hand-written classes all assets).
Unfortunately, this has stopped working since flash-cs4. Does anybody know another solution?
最满意答案
不幸的是,我发现的唯一解决方法是在代码中的某处明确引用每个资产类。 您可以创建这样的虚拟类:
public class AssetsExporter extends Sprite { public static function export() { AssetClass1; AssetClass2; //etc trace( "DEBUG AssetsExporter.export()" ); } }在Flash IDE中将此类指定为Document类,因此它将编译为生成的swc。 然后在您的应用程序调用的主代码中
AssetsExporter.export();完成此操作后,您将能够使用getDefinitionByName()。
Unfortunately, the only workaround I have found is to explicitly refer each of asset classes somewhere in the code. You may create dummy class like this:
public class AssetsExporter extends Sprite { public static function export() { AssetClass1; AssetClass2; //etc trace( "DEBUG AssetsExporter.export()" ); } }Specify this class as Document class in Flash IDE, so it will be compiled into the resulting swc. Then in the main code of your application call
AssetsExporter.export();After doing this you will be able to use getDefinitionByName().
更多推荐
发布评论