Apache flex 使用Flex 3在资源模块中嵌入资源的位图资源

Apache flex 使用Flex 3在资源模块中嵌入资源的位图资源,apache-flex,Apache Flex,我真的很感激在我发现的这个问题上能得到的所有帮助 我已经使用MXMLC工具使用属性文件创建了几个资源模块 正确生成文件,我可以使用resourceManager.loadResourceModule函数加载它们 现在问题来了 在这些文件中,我嵌入了几个图像 在应用程序中,我对这些图像进行了一些修改,只要它们是BitmapAssets 问题是,如果我尝试以下操作,就会得到一个错误或空引用 // With this one I get null. var image:BitmapAsset = re

我真的很感激在我发现的这个问题上能得到的所有帮助

我已经使用MXMLC工具使用属性文件创建了几个资源模块

正确生成文件,我可以使用resourceManager.loadResourceModule函数加载它们

现在问题来了

在这些文件中,我嵌入了几个图像

在应用程序中,我对这些图像进行了一些修改,只要它们是BitmapAssets

问题是,如果我尝试以下操作,就会得到一个错误或空引用

// With this one I get null.
var image:BitmapAsset = resourceManager.getClass( 'myResourceBundle', 'mainImage' ) as BitmapAsset;

// With this one an error.
var image2:BitmapAsset = BitmapAsset( resourceManager.getClass( 'myResourceBundle', 'mainImage' ) );
有没有一种方法我可以使该演员和它的作品正确

再一次,我真的很感激我能得到的所有帮助

谢谢。

resourceManager.getClass返回一个类,而不是实例。将代码重写为以下内容:

var imageResource : Class = resourceManager.getClass('myResourceBundle', 'mainImage');

var image : BitmapAsset = new imageResource();
这应该可以做到,尽管如果编译器抱怨,您可能需要执行BitmapAssetnew imageResource,但现在记不起它是如何运行的。

resourceManager.getClass返回一个类,而不是一个实例。将代码重写为以下内容:

var imageResource : Class = resourceManager.getClass('myResourceBundle', 'mainImage');

var image : BitmapAsset = new imageResource();
这应该可以做到,尽管如果编译器抱怨,您可能需要执行BitmapAssetnew imageResource,但现在记不起它是如何工作的