简体   繁体   English

Flash AS3完全卸载已加载的SWF

[英]Flash AS3 unload loaded SWF completely

how do i absolutely and completely unload a loaded SWF. 我如何绝对和完全卸载已加载的SWF。

Here's the case. 就是这种情况。 I have two different SWF, both have the same movieClips in the library with the same name and instance...but...both have different shape. 我有两个不同的SWF,它们在库中具有相同的movieClip,它们具有相同的名称和实例...但是...两者的形状不同。 So basically both are different but the names. 所以基本上两者都不同,但名称不同。

So i loaded the first.swf into the main.swf, in the first.swf contains button that order the loaded in the main.swf to unloadAndStop() and load the second.swf. 因此,我将first.swf加载到main.swf中,在first.swf中包含一个按钮,该命令命令将main.swf中加载的内容排序为unloadAndStop()并加载second.swf。 But somehow the objects in the second.swf take the shape in the first.swf. 但是以某种方式,second.swf中的对象采用了first.swf中的形状。

I hit the wall with this. 我为此撞墙。 How do i completely unload the first.swf 我如何完全卸载first.swf

Thx guys 谢谢你们

Try to load child swfs ( first.swf and second.swf ) into child application domains of the current application domain ( Usage C in this Article Working with application domains , you can also find code sample from this article below). 尝试将子swfs( first.swfsecond.swf )加载到当前应用程序域的子应用程序域中(本文中的Usage C 与应用程序域一起使用 ,您还可以从下面的本文中找到代码示例)。 With this technique you'll get: 通过这种技术,您将获得:

  1. separate classes (all classes) of first.swf and second.swf from each other first.swfsecond.swf彼此分开的类(所有类)
  2. unload all the class definitions for garbage collection after unloading swf 卸载swf之后,卸载所有类定义以进行垃圾回收

AS3 from the article: 来自AS3的文章:

var appDomainC:ApplicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain); 

var contextC:LoaderContext = new LoaderContext(false, appDomainC); 
var loaderC:Loader = new Loader(); 
loaderC.load(new URLRequest("module3.swf"), contextC);

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

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