Modules are not applications.
 
Application.application is the application in MyApp.mxml

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of s20678
Sent: Wednesday, August 06, 2008 9:35 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Need Help with Modules



I have read couple of posts/presentations regarding Modules..But 
still I am not able to figure out the issue. I really appreciate if 
anyone can help me out here. 

I am getting ReferenceError: Error #1069: Property child not found on 
MyApp and there is no default value.
at HomePageView/loadChildView()
[E:\projects\web\intranet\intranet\flex\src\retail\dsd\src\HomePageVie
w.mxml:7]
at HomePageView/___HomePageView_Button1_click()
[E:\projects\web\intranet\intranet\flex\src\retail\dsd\src\HomePageVie
w.mxml:12]

Here is the code: [When I click 'childView' button in HomePageView 
module, I want ChildPageView to be loaded.]

MyApp.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " xmlns="*" 
creationComplete="initApp()">
<mx:Script>
<![CDATA[
private function initApp():void {
module1.applicationDomain = 
ApplicationDomain.currentDomain;
module1.url="Module1.swf";
}
]]>
</mx:Script>
<mx:ViewStack id="myAppViewStack" width="100%" height="100%" >
<mx:ModuleLoader id="module1" width="100%" height="100%" />
<mx:ModuleLoader id="module2" width="100%" height="100%" />
<mx:ModuleLoader id="module3" width="100%" 
height="100%" />
</mx:ViewStack>
</mx:Application>

Module1.mxml

<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " 
layout="absolute" width="100%" height="100%" xmlns="*" 
creationComplete="initApp()">
<mx:ViewStack id="module1ViewStack" borderStyle="solid" 
width="100%" height="100%" >
<mx:ModuleLoader id="home" width="100%" height="100%" />
<mx:ModuleLoader id="child" width="100%" height="100%" />
</mx:ViewStack>
<mx:Script>
<![CDATA[
private function initApp():void {
home.applicationDomain = 
ApplicationDomain.currentDomain;
home.url="HomePageView.swf";
}
]]>
</mx:Script>
</mx:Module>

HomePageView.mxml

<?xml version="1.0" encoding="utf-8"?> 
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " width="100%" 
height="100%">
<mx:Script>
<![CDATA[ 
import mx.core.Application;
private function loadChildView(){

Application.application.child.applicationDomain = 
ApplicationDomain.currentDomain;

Application.application.child.url="ChildPageView.swf";
} 
]]>
</mx:Script>
<mx:Button label="Child View" click="loadChildView()" />
</mx:Module>

Am I doing something wrong? I heard about having shared variables in 
Application..what are these. Can you please explain me how to resolve 
the error.



 

Reply via email to