updated demo here. you can download the source from riaforge.
i've put up an alpha version here. it's a flex 3.x "mashup" using google maps as the UI plus geonames to supply the tz info once a user clicks on the map.
some things to note:
- it really is alpha quality, error handling, etc. isn't very pretty
- the normal double click to zoom in google maps behavior doesn't work as my single mouse click listener seems to be swallowing all the double clicks, so use the zoom control instead
- it's really too big to be of much practical use, ie a much smaller widget would be better for use on a page (i am as they say "design challenged")
once i iron out all the kinks i'll post the source in the usual places.
update: seems there's an issue w/google maps API where it also fires off a single mouse click event for any double click events, so you can't easily tell the two events apart. workaround was to add shift-key to the mouse click to get tz info for single mouse click.
update: there's some kind of issue w/an iphone app doing a DDOS on the geonames web services, please change your code to use ws5.geonames.org instead of ws.geonames.org.
you can download the source, such as it is, from riaforge.
congratulations and good luck guys.
while it's a short term annoyance i think this is probably for the better long term.
update: tom jordahl's mentioned that the "any" bit will get fixed for the final release.
- create an mxml image object and hang an original set of listeners off it: <mx:Image id="theMap" height="400" width="600" source="" toolTip="the map" useHandCursor="false" mouseMove="utils.showCoords(event); utils.doZoomBox(event);" mouseDown="utils.doZoom(event);"/>
- remove the current listeners and add the new ones as the user changed tools: theMap.removeEventListener(MouseEvent.MOUSE_DOWN,utils.doZoom);
theMap.addEventListener(MouseEvent.MOUSE_DOWN,utils.doPan);
this worked perfectly the first time, then the application would fallback to the original set of listeners defined in the mxml image object (i didn't actually see this at first, i just noticed it fellback on the wrong set of listeners). that is, if i switched to a tool to pan the map image, it would work the first time i panned the image, then it would go back to the zoom tool for the next mouse event. couldn't figure this out after a couple of days, went to the flex-coders list, no joy. another day or so of slowly banging my head against the monitor and i finally had to bother matt the-answering-machine chotin. i guess it took matt about 2 minutes to see my self-inflicted problem.
the problem was that the listener i was removing wasn't the same "listener" as i had originally hung off the mxml image object. when you add a "listener" like that in mxml, it isn't actually a listener, rather it's simply code that will get executed. so when i went to remove it and add a new one, what happened was that only the new listener was added, giving each mouse event two "listeners", the original one in the mxml object and the new one added via actionscript. who knew?
the proper way to handle this is to not define "listeners" on your mxml objects but rather add them during initialization. though in fact matt advised that the original js design was the more "traditional" approach, so that's the method i ended up implementing.
i guess this is another example of the kind of support adobe provides. even though matt is now further up the product food chain he still takes the time to answer technical questions. the same can be said for damon, tom and mike on the ColdFusion team (well when mike was still with adobe anwyay). while i suppose there are other communities with this level of company support, bet you can count them on one hand ;-)
now along comes flex builder version 2.0 (i won't say anything about 1.5, there might be kids present ;-). while it starts up in an acceptable amount of time (not instantly but snappy enough to get my game face on), compiling apps, especially given the habits i've developed from ColdFusion of testing incremental changes and saving code every chance i get, is getting to be a drag. testing concepts--i'm fairly new to flex, so everything is a "new concept" to me & needs to be tested, i don't believe a word the docs says ;-)--and smaller, focused components, it's not too bad. but boy oh boy, complex stuff is taking longer & longer & l-o-n-g-e-r. i tried doing something else, reading email, blogs, listening to matt & peter's podcasts but that just made things worse, stealing RAM from eclipse. so i took to getting up from my workstation & getting a cup of coffee during compilation but with all that extra caffeine in me, i started scaring people and chasing pets in the neighborhood so i've had to find another solution ;-)
since i've more or less lived in a cave when it came to new hardware developments, i'm not sure which way i should jump (except no macs, too old to learn that much), though i do know i want one of those fancy-pants LCD screens. then there's the psychological berlin wall i'll have to hop over when it comes to years of the apps i've accumulated on this box. i hate the thought of wasting a day or more getting the old stuff installed on the new box as well as rummaging around in file cabinets looking for install CDs and serial numbers, etc. in the end though, i guess it's time to put old yeller to sleep.
so anybody care to hand out some advice on hardware specs for a flex capable workstation?
btw i really like flex. i'm in the middle of porting over an old js GUI library (i guess it might be called AJAX these days) and a couple of days ago i threw out gobs of skanky old code that handled browser brand and version quirks. i suppose the more modern AJAX libs handle this stuff transparently but back then it was all on the developer and i for one, am really glad that this probably won't be something i'll have to think about again. and compared to js, flash/flex just seems simpler and more natural to me (at least since i haven't read much about stage, movieclip or timeline lately).
very cool.

