You have a couple different options.

You could use a closure function for the marker click, which 'knows'
about the various variables you require. (Don't really recommend this
option).
You could create a Dictionary or Object which acts like a map to map
the marker to the various variables.
You could extend the Marker class and override the constructor to take
in and store the extra parameters. In the click handler you would cast
it to your new marker class.

I would recommend using the dictionary approach.

Something like:

var markerMap:Object = new Object();

... create markers

markerMap[newMarker] = [variable1, variable2, variable3];

...

public function markerClickEvent(event:MapMouseEvent):void
{
var marker:Marker = event.target as Marker;

var vars:Array = markerMap[marker];

}


-Arothian

On Apr 28, 8:42 pm, jord3t <[email protected]> wrote:
> I needed to pass several custom variables to my marker so i could use
> them in a function when the marker is clicked.
>
> The marker options are limited so I gave the marker icon a name of
> comma separated values which I then use as an array when it's clicked
> like:
>
> var nameVar = "value1,value2,value3";
> markerOptions.icon.name = nameVar;
> marker.addEventListener(MapMouseEvent.CLICK, markerClickEvent);
>
> public static function markerClickEvent(event:MapMouseEvent):void
> {
> marker = event.target;
> var MarkerAR:Array = marker.getOptions().icon.name.toString
> ().toLowerCase().split(",");
> Variable1 = MarkerAR[0];
> Variable2 = MarkerAR[1];
> Variable3 = MarkerAR[2];
>
> }
>
> I'm not sure if this is the best way to do it but it works well for
> me.
>
> anyone else have a different way of doing it?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to