Hi,

Thanks Alex to inform us. I am adding my same code below.

// Sample Code Start
package com
{
        import mx.core.IFlexDisplayObject;
        import mx.events.CloseEvent;
        import mx.events.ModuleEvent;
        import mx.managers.PopUpManager;
        import mx.modules.ModuleLoader;
        import spark.components.TitleWindow;
        
        public class LoadModule
        {
                private var _moduleUrl:String;
                private var _moduleLoader:ModuleLoader;
                private var _popUpWindow:TitleWindow;

                public function LoadModule()
                {
                        this.openModule();
                }
                
                private function openModule():void
                {
                        _moduleUrl = 'testModule.swf';
                         openModuleAsPopUp();
                }
                
                private function openModuleAsPopUp():void
                {
                        _moduleLoader = new ModuleLoader();
                        if(_popUpWindow == null){
                                _popUpWindow = new TitleWindow();
                                
_popUpWindow.addEventListener(CloseEvent.CLOSE,moduleCloseHandler);
                        }
                        _popUpWindow.addElement(_moduleLoader);
                        loadModule(_moduleLoader);
                }
                
                private function loadModule(moduleLoader:ModuleLoader):void
                {
                        
moduleLoader.addEventListener(ModuleEvent.READY,onModuleLoadHandler);
                        
moduleLoader.addEventListener(ModuleEvent.ERROR,onModuleLoadHandler);
                        
moduleLoader.addEventListener(ModuleEvent.SETUP,onModuleLoadHandler);
                        
moduleLoader.addEventListener(ModuleEvent.PROGRESS,onModuleLoadHandler);
                        
moduleLoader.addEventListener(ModuleEvent.UNLOAD,onModuleLoadHandler);
                        
moduleLoader.addEventListener(IOErrorEvent.IO_ERROR,onModuleLoadHandler);
                        moduleLoader.loadModule(_moduleUrl);
                }
                
                private function onModuleLoadHandler(event:ModuleEvent):void
                {
                        switch(event.type)
                        {
                                case ModuleEvent.READY:
                                         
onModuleLoadComplete(event.currentTarget.child);
                                         break;
                                
                                case ModuleEvent.SETUP:
                                         trace("Module Setup");
                                         break;
                                
                                case ModuleEvent.ERROR:
                                         trace("Error while loading module");
                                         break;
                                
                                case ModuleEvent.PROGRESS:
                                         trace("Module load in progress");
                                         break;
                                
                                case ModuleEvent.UNLOAD:
                                         onModuleUnloadComplete();
                                         trace("Unloading module");
                                         break;
                        }
                }
                
                private function onModuleUnloadComplete():void
                {
                        
_moduleLoader.removeEventListener(ModuleEvent.READY,onModuleLoadHandler,false);
                        
_moduleLoader.removeEventListener(ModuleEvent.ERROR,onModuleLoadHandler,false);
                        
_moduleLoader.removeEventListener(ModuleEvent.SETUP,onModuleLoadHandler,false);
                        
_moduleLoader.removeEventListener(ModuleEvent.PROGRESS,onModuleLoadHandler,false);
                        
_moduleLoader.removeEventListener(ModuleEvent.UNLOAD,onModuleLoadHandler,false);
                        
_moduleLoader.removeEventListener(IOErrorEvent.IO_ERROR,onModuleLoadHandler,false);
                }
                
                private function onModuleLoadComplete(child:*):void
                {
                        _moduleLoader.addChild(child as DisplayObject);
                        PopUpManager.addPopUp(_popUpWindow as 
IFlexDisplayObject,FlexGlobals.topLevelApplication as DisplayObject,true);
                        PopUpManager.centerPopUp(_popUpWindow as 
IFlexDisplayObject);
                }
                
                private function moduleCloseHandler(event:Event):void
                {
                        _moduleLoader.unloadModule();
                        PopUpManager.removePopUp(_popUpWindow);
                        _popUpWindow = null;
                }
        }
}

// Sample Code End

-----Original Message-----
From: Devesh Mishra 
Sent: 13 November 2013 12:24
To: users@flex.apache.org
Subject: RE: One of the parameters is invalid while loading a module

Hi Darrel,

Good to listen from you. I have attached my action script sample class file in 
this email. Hope it'll give you a more clarification.

Here are my explanation regarding your queries.

1) I have written PopUpManager.centerPopUp() on ready event, because I want to 
display my popup only when my module get loads completely. Anyways i have 
already tried with something else i.e. I have tried, just after the 
initialization of popup window. But still getting same issue.

2) Yes, I am using moduleLoader.addChild(child), after ready event. You'll get 
more clarification after looking into attached file.

Note: Again repeating, this is happening with only one module. Apart from that, 
I have lots of module in my application and all are working fine. Module where 
I am getting this issue, it contains only one <mx:Module> and inside module 
tag, there is one <s:VGroup width="100%" height="100%" gap="10">

That's it inside my module where I am getting error.


MASTEK LTD.
In the US, we're called MAJESCOMASTEK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of 
Mastek Limited, unless specifically indicated to that effect. Mastek Limited 
does not accept any responsibility or liability for it. This e-mail and 
attachments (if any) transmitted with it are confidential and/or privileged and 
solely for the use of the intended person or entity to which it is addressed. 
Any review, re-transmission, dissemination or other use of or taking of any 
action in reliance upon this information by persons or entities other than the 
intended recipient is prohibited. This e-mail and its attachments have been 
scanned for the presence of computer viruses. It is the responsibility of the 
recipient to run the virus check on e-mails and attachments before opening 
them. If you have received this e-mail in error, kindly delete this e-mail from 
desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to