在 APK 中包含外部资源 [英] Including External Assets to the APK

查看:18
本文介绍了在 APK 中包含外部资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 FlashDevelop 4.0.1 RTM 创建一个简单的 Android 应用程序,我想问一下如何将外部资产(位于 bin 文件夹内的图像、xml 和声音)包含到 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.

谢谢.

推荐答案

据我所知,你不需要外部资产实际上是外部的,它们可以被嵌入,因为无论如何您希望它们嵌入到 apk 中.

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.

所以只需将它们嵌入到您的 swf 中.不要从 bin 文件夹加载资源,而是这样做:

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.

这篇关于在 APK 中包含外部资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆