HOWTO嵌入图像的Actionscript 3 / Flex 3的正确方法是什么?图像、正确、方法、HOWTO

2023-09-08 12:01:37 作者:◇、pAsT_亚熙

我要创建一个游戏,大量的图片被在Actionscript中/ Flex 3的(闪存)使用。现在,我已经达到了设计阶段,我要工作了使用嵌入式图像(其与旋转,颜色等进行操作)的结构方式。

I'm creating a game where a lot of images are being used in Actionscript / Flex 3 (Flash). Now that I've reached the designer stage, I have to work out a structural way of using embedded images (which have to be manipulated with rotation, color, etc.).

不幸的是,调查了一下后,它看起来像你必须手动插入图片之前,你可以使用它们。我现在有它的设置是这样的:

Unfortunately, after investigating a bit, it looks like you have to manually embed images before you can use them. I currently have it setup like this:

Resource.as类文件:

Resource.as class file:

package
{
    public final class Resource
    {
    	[Embed (source="/assets/ships/1.gif" )]
    	public static const SHIPS_1:Class;
    }
}

所以,只为一船我这样的有:

So, just for one ship I so for have to:

把图像中的正确的文件夹中有正确的名称   在Resource.as文件的方式将它命名为   创建常数的Resource.as文件相同的名称

Put the image in the correct folder with the correct name Name it in the same way in the Resource.as file Create the constant with the same name in the Resource.as file

尽管这应该简单地把文件中指定的文件夹中的所有可能的。

Even though this should all be possible by simply putting the file in a specified folder.

为了使事情更糟的是,我仍然有可能使用调用它:

To make things even worse, I still have to call it using:

var test:Bitmap = new Resource.SHIPS_1();

建立非常庞大的应用程序时,必须有更好的方式来处理资源?想象一下,我需要数千张图片,这个系统根本不适合。

There must be better ways to handle resources when creating very huge applications? Imagine I need thousands of images, this system simply wouldn't fit.

推荐答案

var test:Bitmap = new Resource.SHIPS_1();

使用

myImage.source = Resource.SHIPS_1;

的嵌入是正确的。 :D您使用它的方式是错误的:)

The embedding is correct. :D the way you use it is wrong :)

阿德里安