Hi Tracy, thank you for your quick response.
I'm a little stuck on this one... I can't get it to work...

I'm now able to load a module and unload it. But if I load several 
modules, I'm only able to unload the latest one. 

When I try unloading the other loaded modules I receive the follow 
error:


ArgumentError: Error #2025: The supplied DisplayObject must be a 
child of the caller.
 at flash.display::DisplayObjectContainer/removeChild()
 at 
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$remo
veChild()[E:\dev\3.1.0
\frameworks\projects\framework\src\mx\core\UIComponent.as:5074]
 at mx.core::Container/removeChild()[E:\dev\3.1.0
\frameworks\projects\framework\src\mx\core\Container.as:2267]
 at content_module_template_blank/click()
[C:\Inetpub\wwwroot\LWY\UI\UI Score\UI Score 004
\src\content_module_template_blank.mxml:29]


This is my code: 


import mx.states.RemoveChild;
import mx.modules.ModuleLoader;
import mx.controls.Button; 

private var moduleloader:ModuleLoader;
private var button:Button;

public function loadmodule():void {
moduleloader = new ModuleLoader();
tiletest.addChild(moduleloader);
moduleloader.url = "test.swf";
button = new Button();
button.label = "unload";
button.addEventListener(MouseEvent.CLICK, click);
tiletest.addChild(button);
} 

private function click(evt:MouseEvent):void {
tiletest.removeChild(moduleloader);
tiletest.removeChild(button);
} 

<mx:Tile width="100%" height="100%" id="tiletest"/> 
<mx:LinkButton label="Load" click="loadmodule()" buttonMode="true"/>


Thank you very much.

-David. 






Reply via email to