Pirate Map

Well, that took me longer to get around to than I expected :)

Please feel free to download the source for the pirate skin of the Yahoo! Maps API. The zip contains the map FLA/SWF, the relevant class files, and the FLA/SWF for a custom marker. This is a little more robust than the example I posted a few months ago. I refined the graphics a bit, but also included a search box that gets X to mark the spot. :)

A couple notes about the file:

Classes:

  • Pirate Map: This is the main application class, and it is attached to the single movie clip on the stage when you open the main FLA. It manages the skin, and listens to the child elements to implement the search and zooming results.
  • MapZoom: This manages the internal function of the spyglass and is pretty specific to the spy glass approach to zooming. The actual value to zoom to is broadcast out to listeners so that the application can decide what to do with it.
  • YLocationSearch: This class manages a textfield, button and load indicator (along with the various success/error events) for searching for a location. search requests are broadcast out so the application can decide what to do.

Skin filters and Color Transformations:
Off to the right of the stage in the Pirate Map movie clip there is a broken apart vector image of a map. All of the filters that I want to apply to the dynamic map are actually applied to this colorTester movie and then programmaticly copied to the map by the PirateMap class in the applyFilters function.

By setting it up this way, I can see the filters and adjust them as a designer but take advantage of them as a developer. I always hate writing out code for doing setTransform and for filters. I almost never just write them anyways, I would apply them to a symbol, write down the values and then fill out the code. now I’m just saving a step and making the design step a lot easier too.