Scott, I'm not seeing any code that waits for the shared code module to
finish loading before the other modules load.  First-in wins so you
should wait for Ready on sharedCode before continuing.  Similarly, I
don't see that you're waiting for modules to load before applying
history to them.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Scott Melby
Sent: Wednesday, November 14, 2007 9:32 AM
To: [email protected]
Subject: [flexcoders] Converting app to use modules

 


I am converting my application to use Modules... so far most things are 
working, but I have run into two errors that I have yet to work around. 
I have pasted the parts of the code pertaining to modules below the
message.

1) Sometimes a refresh of the browser window (I am setup for 
deeplinking... so it returns to the selectedIndex) results in a Class 
not found error where the Class that cannot be found is my Module class 
for the module for the deep link selectedIndex. Stack trace is pasted 
below.

2) I am also getting intermittent DragManager exceptions. I thought 
that using the SharedCodeModule approach would resolve this... but I 
must have done something wrong. 

As always any help is appreciated.

Thanks
Scott

--- MainView.mxml ---

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " 
layout="absolute" xmlns:components="common.components.*" 
creationComplete="init()" height="100%" width="100%"
paddingBottom="0" paddingTop="0" paddingLeft="0" paddingRight="0">

<mx:Style source="/PMStyles.css"/>

<mx:Script>
<![CDATA[
import common.data.Project;
... 

public function init():void
{
var m:IModuleInfo = 
ModuleManager.getModule("SharedCodeModule.swf");
m.load(ApplicationDomain.currentDomain); 
}

public function handleTabIndexChanged(event:IndexChangedEvent):void
{
deactivateOldTab(event.oldIndex);
activateNewTab(event.newIndex);
} 

public function deactivateOldTab(index:int):void
{
if(index == 0)
{
ApplicationModule(projReportModule.child).deactivate();
}
else if(index == 1)
{ 
ApplicationModule(projDetailsModule.child).deactivate();
} 
else if(index == 2)
{ 
ApplicationModule(elTaskModule.child).deactivate();
} 
else if(index == 6)
{ 
ApplicationModule(setupMod.child).deactivate();
} 
} 

public function activateNewTab(index:int):void
{
if(index == 0)
{
if(projReportModule.child != null)
{
ApplicationModule(projReportModule.child).init();
}
}
else if(index == 1)
{

if(projDetailsModule.child != null)
{
ApplicationModule(projDetailsModule.child).init();
}
} 
else if(index == 2)
{

if(elTaskModule.child != null)
{
ApplicationModule(elTaskModule.child).init();
}
} 
else if(index == 6)
{

if(setupMod.child != null)
{
ApplicationModule(setupMod.child).init();
}
} 

} 

]]> 
</mx:Script>

<mx:Panel width="100%" height="100%" horizontalCenter="0" 
layout="absolute" resizeEffect="Resize"
title="Project Management System - Verson 2.02"
paddingBottom="0" paddingTop="0" paddingLeft="0" 
paddingRight="0">
<components:ExtTabNavigator id="tn" width="100%" height="100%" 
historyManagementEnabled="true"
change="handleTabIndexChanged(event)">
<mx:ModuleLoader id="projReportModule" 
url="projectReportModule/ProjectReportModule.swf" label="Project
Report"/>
<mx:ModuleLoader id="projDetailsModule" 
url="projectDetailsModule/ProjectDetailsModule.swf" label="Project 
Details"/>
<mx:ModuleLoader id="elTaskModule" 
url="elementTaskModule/ElementTaskModule.swf" label="Element/Task"/>
<mx:VBox label="Production Report"/>
<mx:VBox label="Design Report"/>
<mx:VBox label="Calendar"/>
<mx:ModuleLoader id="setupMod" 
url="setupModule/SetupModule.swf" label="Setup"/>
</components:ExtTabNavigator>

<mx:ApplicationControlBar width="95%" height="35">
<mx:HBox width="90%">
<mx:Label text="Status:" color="blue" 
visible="{statusMsg.text.length > 0}"/>
<mx:Label id="statusMsg" text=""/>
</mx:HBox> 
<mx:LinkButton id="logoutLink" color="0x0000ff" toolTip="Logout 
{m_userName}" label="Logout {m_userName}" click="logoutUser(event)"/>
</mx:ApplicationControlBar> 
</mx:Panel>

</mx:Application>

--- SharedCodeModule.mxml ---
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> ">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import common.util.Controller;
import mx.managers.DragManager;

private var controller:Controller;
private var dragManager:DragManager;
private var popupManager:PopUpManager
]]>
</mx:Script>
</mx:Module>

--- Module Class not found exception ---
Error: Class 'projectReportModule.ProjectReportModule' not found.
at _ProjectReportModule_mx_core_FlexModuleFactory/create()
at 
mx.modules::ModuleLoader/moduleReadyHandler()[E:\dev\flex\sdk\frameworks
\projects\framework\src\mx\modules\ModuleLoader.as:332]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at 
ModuleInfoProxy/moduleEventHandler()[E:\dev\flex\sdk\frameworks\projects
\framework\src\mx\modules\ModuleManager.as:1025]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at 
ModuleInfo/readyHandler()[E:\dev\flex\sdk\frameworks\projects\framework\
src\mx\modules\ModuleManager.as:704]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at 
mx.core::FlexModuleFactory/update()[E:\dev\flex\sdk\frameworks\projects\
framework\src\mx\core\FlexModuleFactory.as:324]
at 
mx.core::FlexModuleFactory/docFrameHandler()[E:\dev\flex\sdk\frameworks\
projects\framework\src\mx\core\FlexModuleFactory.as:412]

--- TypeCoercion exception ---
TypeError: Error #1034: Type Coercion failed: cannot convert 
mx.managers::[EMAIL PROTECTED] to mx.managers.IDragManager.
at mx.managers::DragManager$/get 
impl()[E:\dev\flex\sdk\frameworks\projects\framework\src\mx\managers\Dra
gManager.as:150]
at mx.managers::DragManager$/get 
isDragging()[E:\dev\flex\sdk\frameworks\projects\framework\src\mx\manage
rs\DragManager.as:185]
at 
mx.controls.listClasses::ListBase/dragScroll()[E:\dev\flex\sdk\framework
s\projects\framework\src\mx\controls\listClasses\ListBase.as:7083]
at Function/http://adobe.com/AS3/2006/builtin::apply
<http://adobe.com/AS3/2006/builtin::apply> ()
at <anonymous>()
at SetIntervalTimer/onTimer()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()

 

Reply via email to