Hello everybody,
I'm trying to dispatch a MapMouseEvent from a Marker (created before).
But it doesn't work at all.
Here is the code:
##### Creating Marker, adding EventListener and storing the marker in
a Array:
[Bindable]
public var allMarkers:Array = new Array();
private function
addPoint(lat,lon,centerLat,centerLon,centerZoom,item,titRegiao,txtRegiao,
pais, cidade, data):void {
var bm:Bitmap = new ataqueIcon() as Bitmap;
var point:LatLng = new LatLng(lat,lon);
var itemAtual = item;
var centerPoint:LatLng = new
LatLng(centerLat,centerLon);
var marker:Marker = new Marker(point,
new MarkerOptions({icon:bm, iconOffset:new
Point(-10, -24),
hasShadow:true}));
marker.addEventListener(MapMouseEvent.CLICK,
function
(event:MapMouseEvent):void {
marker.openInfoWindow(new
InfoWindowOptions({width:200, height:
110, drawDefaultFrame: true, customContent: infoWindow}));
map.flyTo(centerPoint,centerZoom,map.getAttitude(),1);
doingZoom = true;
map.addEventListener(MapEvent.FLY_TO_DONE, fixMap)
});
map.addOverlay(marker);
allMarkers.push(marker);
}
#### Dispatching
atual = 0;
var actualMarker:Marker = allMarkers[atual] as Marker;
actualMarker.dispatchEvent(new MapMouseEvent(MapMouseEvent.CLICK,
actualMarker, actualMarker.getLatLng()));
When I try to dispatch the event using this code the application stuck
and, after some seconds, I get a big error:
undefined
at com.google.maps.wrappers::BaseEventDispatcher/
removeEventListener()
at com.google.maps.wrappers::WrappedListenerCache/
removeEventListener()
at com.google.maps.wrappers::EventDispatcherWrapper/
removeEventListener()
at com.google.maps.overlays::Marker/onInfoWindowClosing()
at MethodInfo-208()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks
\projects\framework\src\mx\core\UIComponent.as:9298]
at com.google.maps.wrappers::BaseEventDispatcher/dispatchEvent()
at com.google.maps.wrappers::EventDispatcherWrapper/dispatchEvent()
at com.google.maps.core::MapImpl/onInfoWindowClosing()
at MethodInfo-208()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.google.maps.overlays::Pane/dispatchOverlayEvent()
at com.google.maps.overlays::Pane/removeOverlay()
at com.google.maps.core::MapImpl/removeOverlay()
at com.google.maps.core::MapImpl/closeInfoWindow()
at com.google.maps.core::MapImpl/openInfoWindowOnOverlay()
at com.google.maps.overlays::Marker/openInfoWindow()
at com.google.maps.wrappers::IMarkerWrapper/openInfoWindow()
at <anonymous>()[C:\Users\domenico.citrangulo\Documents\Flex Builder
3\Linha e Mapa\src\timeline.mxml:411]
at <anonymous>()
........
Any idea?!?!
--
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.