本文介绍了我如何卸载从Adobe Flex的一个SWFLoader组件外部加载的SWF文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个加载外部SWF文件和通过的。我一直试图找到一种方法,从一个按钮单击事件卸载它们。我已经Google'd甚广,没有人似乎已经能够做到没有破解。的code我看到人们使用的组合是:

  swfLoader.source =; //删除到SWF的外部链接。
swfLoader.load(空); //强制加载器来尝试加载什么。
//注意:在从SWF这点声仍在播放,并
//似乎依然在内存中播放。
flash.media.SoundMixer.stopAll();
//停止声音。这个工作对我的开发机,但不
//在客户端的。
 

如果主权财富基金的关闭(隐藏)这种方式,最终程序崩溃。

任何想法?我发现吨,在各个论坛的帖子与具有人一样的问题。我想我会得到一个错误/不完整的答案在这里,比我的帖子会陷入虚无往常一样,但无论哪种方式,在此先感谢!

编辑1 的:我不能编辑实际SWF电影,它们是由客户端创建。如果我无法关闭通过的Flex打开任何SWF,是不是与Flex架构的问题吗?是我唯一的选择发送的主权财富基金的网络浏览器?

解决方案

的确是这样,而且还严重影响Flash一般。直到你可以利用的Loader.unloadAndStop()在FP10(AIR 1.5)方法,你不能保证外部加载的内容将不会继续消耗内存和CPU资源,即使你使用 Loader.unload()方法。 (说实话,我不是100%肯定,即使这将保证释放的资源,但也许我是一个悲观主义者。)

接下来的最好的事情是让你坚持,你加载遵守一套准则,包括露出有点像配置()方法内容的创造者这您的应用程序可以打电话问它,然后释放尽可能多的资源尽可能卸载()它。如果这是不可能的,那么你的应用程序将几乎肯定在内存和CPU使用率每次加载外部SWF膨胀。抱歉。

如果它让你感觉更好,你并不孤单。 ;)

I have an application that loads external SWF files and plays them inside a Adobe Flex / Air application via the SWFLoader Flex component. I have been trying to find a way to unload them from a button click event. I have Google'd far and wide and no one seems to have been able to do it without a hack. The combination of code I see people use is:

swfLoader.source = ""; // Removes the external link to the SWF.
swfLoader.load(null); // Forces the loader to try to load nothing.
// Note: At this point sound from the SWF is still playing, and
// seems to still be playing in memory.
flash.media.SoundMixer.stopAll();
// Stops the sound. This works on my development machine, but not
// on the client's.

If the SWFs are closed (hidden) this way, eventually the program crashes.

Any ideas? I have found tons of posts in various forums with people having the same problem. I assume I will get one wrong/incomplete answer here, and than my post will sink into nothingness as usual, but either way, thanks in advance!

Edit 1: I can't edit the actual SWF movies, they're created by the client. If I can't close any SWF opened through Flex, isn't that a problem with the Flex architecture? Is my only option sending the SWFs to the web browser?

解决方案

Yes it is, and it also affects Flash in general. Until you can take advantage of the Loader.unloadAndStop() method in FP10 (AIR 1.5), you can't guarantee that externally loaded content will not continue to consume memory and cpu resources, even if you use the Loader.unload() method. (To be honest, I'm not 100% sure that even that will guarantee freeing of resources, but maybe I'm a pessimist.)

The next best thing is for you to insist that the creators of the content you load adhere to a set of guidelines, including exposing something like a dispose() method which your app can call to ask it to release as many resources as possible before you unload() it. If this isn't possible, then your application will almost definitely bloat in memory and cpu usage each time you load an external swf. Sorry.

If it makes you feel any better, you're not alone. ;)

这篇关于我如何卸载从Adobe Flex的一个SWFLoader组件外部加载的SWF文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 17:54
查看更多