See the modules presentation on my blog.  That's the shared-code problem.  
Singletons need to be in the main app or a shared-code module.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of grg_blls
Sent: Wednesday, March 18, 2009 4:37 AM
To: [email protected]
Subject: [flexcoders] A ModuleLoader issue


Hi all,

I have the following problem with my current development. A client is loging in 
the system either as customer or admin and accordingly the main application 
through module manager loads either "module1" or "module2".
If a client is logged as customer (i.e. "module1" is loaded), he is offered a 
number of choices, leading to loading one of "module1a", "module1b", etc.

In every case the procedure is a unload previous/load next module through:

public function createModule(m:ModuleLoader, s:String):void{
m.url = s;
m.loadModule();
}

public function removeModule(m:ModuleLoader):void {
m.unloadModule();
}

Finally that client is logged out when finished.

Now if he does a new login as a customer, "module1" loads and offers again the 
customers options, but if he tries the same option (which leads to loading 
"module1a"), an error is thrown, with the following message from the Flash 
Player:

An ActionScript error has occured
TypeError: Error #1034: Type Coercion failed: cannot convert 
mx.managers::historymanageri...@683d219 to mx.managers.IHistoryManager.
at mx.managers::HistoryManager$/get 
impl()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\HistoryManager.as:96]
at 
mx.managers::HistoryManager$/register()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\HistoryManager.as:134]
at 
mx.containers::ViewStack/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\containers\ViewStack.as:649]
at 
mx.containers::TabNavigator/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\containers\TabNavigator.as:504]
at 
mx.core::UIComponent/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:5670]
at 
mx.managers::LayoutManager/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:519]
at 
mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:639]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at 
mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8460]
at 
mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8403]

Any ideas, as to the nature of it and where to look fixing?
Thanks all in advance

George

Reply via email to