First you have to extend your Polygon:

package map
{
    import com.google.maps.overlays.Polygon;
    import com.google.maps.overlays.PolygonOptions;

    public class CustomPolygon extends Polygon
    {

        private var _obj:Object;

        public function CustomPolygon(arg0:Array, arg1:PolygonOptions=null)
        {
            super(arg0, arg1);
        }

        public function get obj():Object {
            return this._obj;
        }

        public function get obj(v:Object):void {
            this._obj = v;
        }
    }
}

after... change your var gridBlock

        var gridBlock:CustomPolygon= new CustomPolygon([
                    new LatLng(topLeftLat, topLeftLong),
                    new LatLng(bottomLeftLat, bottomLeftLong),
                    new LatLng(bottomRightLat, bottomRightLong),
                    new LatLng(topRightLat, topRightLong)
                    ],
                    new PolygonOptions({
                    strokeStyle: new StrokeStyle({
                        color: 0x00FFFF,
                        thickness: 1,
                        alpha: 1}),
                        fillStyle: new FillStyle({
                        color: 0x666666,
                        alpha: 0.7})
                    })
                );

                var myObj:Object = new Object;
                myObj .id = i;
                gridBlock.obj = myObj;

                gridBlock.addEventListener(MapMouseEvent.CLICK,
clickedBlock);

                map.addOverlay(gridBlock);

after...

create a method like this... it'll recieve your MapMouseEvent.CLICK

        private function clickedBlock(e:MouseEvent):void {
            var block:Polygon = e.currentTarget;
            Alert.show(block.obj.id.toString());
        }

wating for the answer..

Thiago

-- 
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