Hey Guys, i still haven't got it to work, plus more bigger problems, i have
decide to split my application into modules, i each module i have an array
collection that populates a list in each of the modules, but when i run the
application, only data in the first module is retrieved and when i load the
second module, the data is not retrieved (doesn't show up in the list). below
is the code.
main.mxml
==
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=vertical
width=100%
height=100%
verticalAlign=top
verticalGap=0
paddingTop=0
paddingBottom=0
paddingLeft=0
paddingRight=0
xmlns:ns2=components.*
mx:Style source=css/styleSheet.css/
mx:HBox styleName=header
width=100%
height=50
verticalAlign=middle
verticalGap=0
mx:Image source=assets/logo.png/
mx:Spacer width=100%/
mx:Label text=Logged in as: Aaliyah Ntulo/
mx:Image source=assets/power.png/
/mx:HBox
mx:HBox width=100%
height=100%
horizontalGap=0
mx:VBox width=200
height=100%
verticalGap=0
backgroundColor=#818284
horizontalAlign=center
ns2:menuButton click=navStack.selectedChild=dashBoard
mx:Image source=assets/dashboard.png/
mx:Label text=Dashboard/
/ns2:menuButton
ns2:menuButton click=navStack.selectedChild=operator
mx:Image source=assets/drivers.png/
mx:Spacer/
mx:Label text=Drivers/
/ns2:menuButton
ns2:menuButton
mx:Image source=assets/car.png/
mx:Spacer/
mx:Label text=Vehicles/
/ns2:menuButton
/mx:VBox
mx:ViewStack id=navStack width=100% height=100%
mx:ModuleLoader id=dashBoard
url=dashBoardModule.swf/
mx:ModuleLoader id=operator
url=driversModule.swf/
/mx:ViewStack
/mx:HBox
/mx:Application
dashBoardModule.mxml
==
?xml version=1.0 encoding=utf-8?
mx:Module xmlns:mx=http://www.adobe.com/2006/mxml;
layout=horizontal
width=100%
height=100%
xmlns:ns1=ascript.*
horizontalGap=0
creationComplete=init();
initialize=initDate();
mx:Script
![CDATA[
import components.newEntryForm;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.CollectionEvent;
import mx.managers.CursorManager;
import mx.managers.PopUpManager;
import mx.rpc.events.ResultEvent;
protected const MAX_DATE:Date=new Date(2020, 11, 31);
/*** code to Filter based on Date Range
*/
protected const MIN_DATE:Date=new Date(2014, 0, 1);
/*** Start Pop Ups */
private var add_win:newEntryForm;
/*** code to get Expense Details
*/
[Bindable]
private var expenseAr:ArrayCollection;
public function calculateSum(event:CollectionEvent):void
{
var amt:Number=0;
var n:int=expenseAr.length;
for (var i:int=0; i n; i++)
{
var expenseEntry:Object=expenseAr.getItemAt(i);
amt+=Number(expenseEntry.subTotal);
}
sum.text=ugxftr.format(amt.toString());
}
protected function arrColl_filterFunc(item:Object):Boolean
{
var cDate:Number=Date.parse(item.hireDate);
if (!sDate || !eDate)
{
return true;
}
if (sDate.selectedDate eDate.selectedDate)
{
return (sDate.selectedDate.time = cDate)
(eDate.selectedDate.time = cDate);
}
else if (sDate.selectedDate)
{
return sDate.selectedDate.time = cDate;
}
else if (eDate.selectedDate)
{
return eDate.selectedDate.time = cDate;
}
else
{
return true;
}
}
protected function initDate():void
{
sDate.selectedDate=MIN_DATE;