How To Run a Function After the Map Has Finished Loading
A web map will not fully appear and function in your web page until after all of its components have been downloaded. Depending on the size of your map this can take some time. You may want to have processing that occurs only after the map is ready. You can pass a function in the loadedCB parameter of the embedViewer API that will be called after the map has finished downloading and initializing.
<html>
<head>
<script type="text/javascript" src="map_data/swfobject.js"></script>
<script type="text/javascript" src="map_data/avenza.js"></script>
<script type="text/javascript">
var theMap = AVENZA.embedViewer("map", "750", "500",
{
baseURL:"map_data/",
loadedCB: mapLoadComplete,
flashSecuritySandbox: AVENZA.AUTO_SANDBOX
}
);
function mapLoadComplete() {
alert("The map has finished loading");
}
</script>
</head>
<body>
<div style="position:relative">
<div id="map">
</div>
</div>
</body>
</html>
You can see a live example here.

