【问题标题】:AS3 | Dynamically assets embeddingAS3 |动态资产嵌入
【发布时间】:2015-06-16 12:55:06
【问题描述】:

我正在尝试在嵌入我的游戏资产的同时添加通用内容,但到目前为止一无所获。我通常做的是:

public final class AssetsManager 
{
   [Embed(source="../assets/game1/icon.png", mimeType = "image/png")]
   private static const Icon:Class;
}

但是,我想做这样的事情:

public final class AssetsManager(gameName:String)
{
   [Embed(source="../assets/"+gameName+"/icon.png", mimeType = "image/png")]
   private static const Icon:Class;
}

我无法通过类传递参数,所以我相信还有另一种方法。

【问题讨论】:

  • 我已经在你的另一个问题中回答了这个问题。您需要在运行时动态加载内容,或者使用编译器常量并根据目录值制作不同版本的 swf 文件。

标签: actionscript-3 flashdevelop flash-cc


【解决方案1】:

嵌入发生在编译时,所以这是不可能的。相反,您可以在运行时加载资产,例如使用URLLoader 作为ByteArray,或Loader 作为Bitmap,或Flex Image 控件。

【讨论】:

    猜你喜欢
    • 2011-11-18
    • 1970-01-01
    • 1970-01-01
    • 2023-03-27
    • 1970-01-01
    • 2011-03-31
    • 1970-01-01
    • 2012-04-05
    • 2012-09-06
    相关资源
    最近更新 更多