简体   繁体   English

如何减少资产为1000的AIR Flash应用程序中的内存(RAM)使用量?

[英]How can I reduce memory (RAM) usage in an AIR Flash app with 1,000s of assets?

I'm packaging an Adobe Air app for iOS and Android and my (RAM) memory usage is over 100MB. 我正在打包一个适用于iOS和Android的Adobe Air应用程序,我的(RAM)内存使用量超过100MB。 I have a very large number of assets in my game (RPG). 我的游戏(RPG)中有大量资产。 It seems that the quantity/size of assets directly effects memory usage. 资产的数量/大小似乎直接影响内存使用率。 The memory usage is present before any items are declared or instantiated. 在声明或实例化任何项目之前就存在内存使用情况。 I can make a blank project with no Action Script and the memory usage is still over 100MB based on the number/size of assets in my library. 我可以创建一个没有Action Script的空白项目,根据库中资产的数量/大小,内存使用量仍超过100MB。

I'm looking for a way to package my app so that every single asset isn't loaded into memory when the game launches. 我正在寻找一种打包应用程序的方法,以便在游戏启动时不会将每个资产都加载到内存中。 I've tried packing my assets into a SWC and importing that into my project (using the "merged into code" option) and the results are the same. 我尝试将资产打包到SWC中并将其导入到我的项目中(使用“合并到代码”选项),结果是相同的。

1) Is there a way to bundle a SWC so that its contents are no immediately loaded into memory? 1)有没有办法捆绑SWC,以便不立即将其内容加载到内存中?

2) Are there any other methods I can try so that my app doesn't immediately load the assets into memory? 2)是否可以尝试其他方法使我的应用不会立即将资产加载到内存中?

I can't optimize my audio assets (the largest contributor to the issue) any further. 我无法再进一步优化我的音频资产(对该问题的最大贡献者)。 It is a music game and I can't really go below 128kbps MP3. 这是一个音乐游戏,我不能真正低于128kbps MP3。

Flash Pro CS6 - Action Script 3 - Adobe Air 3.3 Flash Pro CS6-动作脚本3-Adobe Air 3.3

As far as I know, you can't load swc files during runtime. 据我所知,您无法在运行时加载swc文件。 You can on the other hand load SWF files during runtime. 另一方面,您可以在运行时加载SWF文件。

So, you separate your assets into multiple SWF files then load the ones you need when appropriate. 因此,您可以将资产分成多个SWF文件,然后在适当时加载所需的文件。 If you want to create items from the loaded SWF file's library you will use ApplicationDomain and getDefinition. 如果要从加载的SWF文件的库中创建项目,则将使用ApplicationDomain和getDefinition。

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

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