I am trying to develop a mobile based flex application.
In my application, I have two views.
I am trying to pass the ArrayCollection as a data from one view to another view, but while trying to access ArrayCollection on the second view, I am getting an error ..
Here's code from firstView.mxml :
dirSteps is the arraycollection that I am trying to pass to next view ...
for (var r:Number = 0 ; r < directions.numRoutes; r++ ) {
var route:Route = directions.getRoute(r);
if (r >= 0 || r < (numRoutes - 1)) {
var midMarker:Marker = new Marker(route.endLatLng);
map.addOverlay(midMarker);
}
var numSteps:uint = route.numSteps;
for (var s:Number = 0 ; s < numSteps ; s++ ) {
var step:Step = route.getStep(s);
dirSteps.addItem({Step: (s+1), Description: step.descriptionHtml, Distance: step.distanceHtml, LatLng: step.latLng});
}
}
dirSteps.refresh();
}
..... some more code ...
navigator.pushView(DetailDirection,dirSteps);
Code from DetailDirection.mxml :
[Bindable]
private var directionList:ArrayCollection;
private function init():void {
directionList = new ArrayCollection(ArrayUtil.toArray(data));
// here, data should be my arraycollection, but throws above error on
// trying to access property (i.e Step, Distance etc .. ) of ArrayCollection ...
trace(data.Distance);
}
Error: Unknown Property: 'Distance'. at mx.collections::ListCollectionView/http://www.adobe.com/2006/actionscript/flash/proxy::getProperty()[E:\dev\4.y\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:870] at views::DetailDirection/init()[C:\Documents and Settings\ARSENAL\Adobe Flash Builder 4.6\CityExplorer_v2.0\src\views\DetailDirection.mxml:21] at views::DetailDirection/___DetailDirection_View1_creationComplete()[C:\Documents and Settings\ARSENAL\Adobe Flash Builder 4.6\CityExplorer_v2.0\src\views\DetailDirection.mxml:6] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152] at mx.core::UIComponent/set initialized()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:1818] at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:842] at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]
What is causing this error ? What needs to be done ?
Anything that I am missing here ?
Thanks