Including External Assets to the APK

寵の児 提交于 2019-12-12 05:18:36

问题


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.

Thanks.


回答1:


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.

So just embed them into your swf. Instead of loading assets from the bin folder, do this:

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.



来源:https://stackoverflow.com/questions/9898117/including-external-assets-to-the-apk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!