I'm trying to load windowed sub-application in another windowed application, The requirement is to replace one loaded application with another on user action.

I tried the documented method of unloadAndStop() on the swfLoader in the main windowed application, but somehow during memory profiling I could see the instances of those applications were maintained in the memory even after explicitly running garbage collection.

Where as If I make those windowed application as modules, and then try to load them using the Moduleloader things work smoothly and unloaded modules are removed from memory.

Any one faced the same issue before ?

有帮助吗?

解决方案

其他提示

First, you should load an application within an application. All sorts of crazy things could happen. I have encountered your situation in the past. What I have done is separate out my actual UI/Product for any Application or Module task. For example:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx">
   <local:YourMainUI width="100%" height="100%" />
</s:Application>

or

<?xml version="1.0" encoding="utf-8"?>
<s:Module xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx">
   <local:YourMainUI width="100%" height="100%" />
</s:Module>

You see where I'm going with this? You now have a reusable "main" component for your product with can be used in whichever context, even the WindowedApplication one :)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top