Yahoo! Maps, hAPI hAPI, JOY JOY

Well most of you have seen it on MAX, "hAPI hAPI, JOY JOY". One of the slogans that were on the T-shirts that they gave away at MAX. But until tonight I didn't had any change to play with the API (to be honest, I don't have the time to play, but sometimes you just have to make time!). But I got a little frustrated with the events that are/should be fired from the API. For instance the zoomEnd event is not fired when the zoomsequence ended. After some debugging, I came up with a simple work around for this issue.

Add a event listener for the "zoom" event, which is fired multiple times in a zoom sequence. And compare the "currentZoomLevel" with the "endZoomLevel". If they're equal, trigger your custom zoomEnd function.

// (other) imports and listeners
myMap.addEventListener("zoom", zooming);
...
// other code
function zooming(obj){
   trace(obj.currentZoomLevel);
   myMap.setCenterByAddress(address, 0);
   if(obj.currentZoomLevel == obj.endZoomLevel){
   zoomEnded();
   }
}

Something else that isn't working correctly is the "setCenterByAddress" method. It works fine if you do step by step zooming, but if you go from zoom level 14 to 1, your marker that was set with a "addMarkerByAddress" method doesn't show up centered.

I'll try to finish the little demo in a few minutes and upload it to my demo section. Also keep in mind that I'm a Coldfusion developer, NOT a flash developer, so please let me know if you're not having any trouble with this. Any help or idea is very, very welcome!

EDIT: The little test is now online in my demo section. Click the link in the upper menubar or click here, http://demo.wantonline.com/

Comments
BlogCFC was created by Raymond Camden. © Copyright 2004 - 2006 Michael van Leest.
iTunes Store Home Page