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.

 
Products Download Purchase Resources Support About Us

 

 

Follow us on Twitter
Follow us on Twitter

MAPublisher
MAP LabelPro
MAP FME Auto
Geographic Imager
MAPdata
MAPdataCanada
MAPdataUSA
MAPdataWorld
MajorCitiesUSA
PDF Maps
MAPublisher
Geographic Imager
MAPdataCanada
MAPdataUSA
MAPdataWorld
MajorCitiesUSA
Order by Phone
Order by Fax
Order by Email
Order Online
Direct Download
Resellers
Resources Blog
Map Awards
Map Gallery
Training Courses
YouTube Channel
Styles & Symbols
Web Author API
Contact Support
User Guides and Tutorials
User Forums & FAQ
Product Activation
Retrieve License File
Renew Maintenance
Maintenance Login
History
Careers
Contact
News
Events