DIY Map

JavaScript Integration

DIY Map uses the Flash JavaScript Integration Kit to communicate with JavaScript — and vice versa.

The kit works with IE 6.0, Firefox 1.0, and Opera 8.0 and up on Windows; Opera 8.0, Firefox 1.0, Safari 1.2.4 and 2.0 and up on the Mac, and Firefox 1.0.4 and up on Linux.

Each DIY Map download bundle includes a with_javascript directory which includes a sample HTML file, the required JavaScript libraries, and JavaScriptFlashGateway file. These must be called from your HTML page in order for the JavaScript Integration to work. In my sample zip file, the JavaScript libraries and JavaScriptFlashGateway files are in the js directory. These files are required for the javascript integration to work.

Here’s an example:

Zoom Out

Make California: Red, White, Black

getZoom | getCoords

JavaScript Commands

The following JavaScript commands work with DIY Map:


flashProxy.call('zoomOut'):   Zooms out the map.


flashProxy.call('zoomTo','ID'):   Zooms the map to the state with the state defined in your data file with the id 'ID'.


flashProxy.call('zoomPoint','New York City'):   Zooms the map to the point defined in your data file the name 'New York City'.


flashProxy.call('setColor','ID','ff0000'):   Changes the color hexcode of the state defined in your data file with the id 'ID'.


flashProxy.call('refreshData','other_data.xml'):   Reloads the data file without reloading the SWF. Use the second parameter to specify the new data file to load.


Please note: There are known issues with the JavaScript-Flash integration kit. zoomPoint will not work if the city name contains a hyphen, apostrophe, or multibyte (i.e. accented) character. These are not bugs in DIY Map, they are bugs in the Flash JavaScript gateway. Please see the Flash-Javascript bug tracker.