简体   繁体   中英

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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