The Yahoo! maps AS3 API provides a SearchMarker class that is used to display on the map an icon representing a LocalSearchItem class object. The LocalSearchItem class is used to store data contained in a result returned from searching the Yahoo! Local listings (see the related entry below). This data includes phone, address, website, title, etc. However, you can create your own LocalSearchItem objects and use these objects to create SearchMarker objects and display those on the map. The LocalSearchItem class documentation is a bit confusing on how to create an object of the class, so I thought a blog entry and example (right click on the app to view source code) might be helpful.
To create a LocalSearchItem object you must provide the constructor with an XML object that contains various nodes (for example <addr>, <city>, <state>). What confused me about the XML was that in the documentation for LocalSearchItem it lists a latlon property of type latlon. So I was initially stumped as how I could create an XML object that contained a node with a latlon object. But then Dan Tavelli pointed out to me that the XML results returned from doing a search of Yahoo! Local contained a <lat> and a <lon> node and not some kind of latlon object.
So I experimented with creating an XML object that contained nodes to match the properties of the LocalSearchItem class, except for using separate <lat> and <lon> nodes. Also, I found out that if you want the phone number to display on the SeachMarker object you should use a node named <dphone> not phone (as the LocalSearchItem class documentation lists).
In my example I created an Address object and then called the geocode method. If the Address object can be successfully geocoded, my function handleGeocodeSuccess is executed. Now my Address object has a geocoderResultSet property that I can use to pull out the information I need to help create the XML used to create the LocalSearchItem object. For example to get the latitude value I can use:
or to get the city value I can use:
Take a look at class GeocodeResult to see all the values you can access after your address is successfully geocoded.
After building the XML object, I used it to create the LocalSearchItem object. I then used the LocalSearchItem object to create the SearchMarker object and then added the SearchMarker object to the map. When you click on the SearchMarker object the information I used to create the XML is displayed.
Using the above technique, it would not be difficult to get data from your database (using ColdFusion of course!) that included, an address string, a phone number, a URL, a title, etc and then use that data to create SearchMarker objects and display them on your map.