I have a datagrid that has a clickable column. When an item in the column is
clicked, a popupwindow is executed that instantiates an HTMLloader to
display a google map. I also have javascript functions that add a couple of
markers to the map if called within my AIR app. The first time that the
popupwindow opens, it takes like 20-40 seconds for a map to show up. If I
close the popupwindow and click another link, it pulls the map up almost
immediately and continues to do so for each popupwindow opened thereafter.
The question is, what is the hangup with the first map load? Here is a look
at my HTMLloader and the HTML/Javascript that I use:
protected function initializeHandler(event:FlexEvent):void
{
/* ******* Filter Array Collection to only
Display Desired Content
******* */
dataArrayCollection.filterFunction = null;
dataArrayCollection.refresh();
dataArrayCollection.filterFunction =
recordFilter;
dataArrayCollection.refresh();
/* **************** Create and Load a Google
Map **************** */
var file:File =
File.applicationDirectory.resolvePath("googleCode/TheKeyMaps.html");
var urlReq:URLRequest = new
URLRequest(file.nativePath);
mapLoader = new HTMLLoader();
mapLoader.addEventListener(Event.COMPLETE,
allReady);
mapLoader.placeLoadStringContentInApplicationSandbox = false;
mapLoader.width = compGrid.width;
mapLoader.height = 350;
uiComponent = new UIComponent();
uiComponent.width = compGrid.width;
uiComponent.height = 350;
uiComponent.addChild(mapLoader);
uiComponent.top = 0;
uiComponent.left = 0;
this.addElement(uiComponent);
mapLoader.load(urlReq);
}
protected function allReady(event:Event):void {
var latitude:Number;
var longitude:Number;
mapLoader.window.loadKeyMap(origLat, origLong);
mapLoader.window.addMainMarker(origLat,
origLong, blcString);
for (var i:int = 0; i <
dataArrayCollection.length; i++) {
latitude =
Number(dataArrayCollection[i]["latitude"]);
longitude =
Number(dataArrayCollection[i]["longitude"]);
blcString = "<div>BLC
#"+dataArrayCollection[i]["blcNum"].toString()+":
"+dataArrayCollection[i]["address"].toString()+"</div>";
mapLoader.window.addMarker(latitude,
longitude, blcString);
}
}
*And this is my HTML/Javascript file:*
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="map"></div>
</body>
</html>
--
View this message in context:
http://apache-flex-users.2333346.n4.nabble.com/Loading-Google-Maps-into-HTMLLoader-is-very-slow-the-first-time-tp13066.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.