Graphics Programs Reference
In-Depth Information
If you were to compile and run the animation now, you'd get dots, but it
doesn't work with the map's zoom and pan, as shown in Figure 8-46. As
you drag the map back and forth or zoom in and out, the bubbles for each
store are stationary.
FIGurE 8-46 Growth map with incorrect pan and zoom
Listeners are added in the constructor so that the dots move whenever
the map moves. Whenever a Mapevent is triggered by Modest Maps, a cor-
responding function defined in MarkersClip.as is called. For example in
the first line below, onMapStartZooming() is called when a user clicks on the
map's zoom button.
this.map.addEventListener(MapEvent.START_ZOOMING,
onMapStartZooming);
this.map.addEventListener(MapEvent.STOP_ZOOMING,
onMapStopZooming);
this.map.addEventListener(MapEvent.ZOOMED_BY, onMapZoomedBy);
this.map.addEventListener(MapEvent.START_PANNING,
onMapStartPanning);
this.map.addEventListener(MapEvent.STOP_PANNING,
onMapStopPanning);
this.map.addEventListener(MapEvent.PANNED, onMapPanned);
This gives you the final map, as shown in Figure 8-47.
Search WWH ::




Custom Search