简体   繁体   English

将外部资产包括到APK中

[英]Including External Assets to the APK

I am using FlashDevelop 4.0.1 RTM to create a simple Android app and I would like to ask how to include external assets (images, xml & sounds located inside the bin folder) to the apk package. 我正在使用FlashDevelop 4.0.1 RTM创建一个简单的Android应用,我想问一下如何将外部资源(位于bin文件夹中的图像,xml和声音)包含到apk包中。

Thanks. 谢谢。

As far as I see, you don't need the external assets to be actually external, they can be embedded , since anyway you want them embedded into the apk. 据我所知, 您不需要将外部资产实际上是外部的,就可以将其嵌入 ,因为无论如何您都希望将其嵌入到apk中。

So just embed them into your swf. 因此,只需将它们嵌入到您的swf中即可。 Instead of loading assets from the bin folder, do this: 而不是从bin文件夹中加载资产,请执行以下操作:

public class YourClass {
    // Embed the asset
    [Embed(source='assets/yourImage.jpg')] private var yourImageClass:Class;

    // ...

    // Use the asset
    private function someFunction():void {
        var yourImage:DisplayObject = DisplayObject(new yourImageClass());
    }
}

You can embed pretty much any kind of file. 您几乎可以嵌入任何类型的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM