Hi, Ben.
I had the same challenge, and after some experimentation, I came up
with a very easy and extensible solution which involves extending the
Marker class.
First of all, you can use the event.target to determine which Marker
was the source of the event. Next, you need a way to attach some user
data to each Marker. That's where the magic lies! See below for an
example. You can follow this pattern to add whatever data you want to
a Marker, and then you can access it in the event handler using
something like:
dataForSelectedMarker : Object = DataBoundMarker(event.target).data
See below for the mechanism for a sample of the extended Marker class.
HTH,
Rick
=============
package mystuff
{
import com.google.maps.overlays.Marker;
import com.google.maps.overlays.MarkerOptions;
import com.google.maps.LatLng;
public class DataBoundMarker extends Marker
{
[Bindable]
public var data : Object;
public function DataBoundMarker(arg0:LatLng,
arg1:MarkerOptions=null, dataRow:Object=null)
{
super(arg0, arg1);
this.data = dataRow;
}
}
}
On Feb 19, 7:45 pm, BenP <[email protected]> wrote:
> Hi, I have an array of markers, and am looking for a way to identify
> which marker the user has just rolled over.
> basically getting some kind of Marker ID via the event would be great.
>
> I thought abbout adding a custom event, which would contain an
> Id:Number field, but i don't know how to extent
> MapMouseEvent.ROLL_OVER to insure it will work on a roll over.
>
> I can extract the markers latlng form the roll over event, but really
> don't want to have to resort to searching my marker array to fine the
> correct one.
--
You received this message because you are subscribed to the Google Groups
"Google Maps API For Flash" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api-for-flash?hl=en.