Hi,

I want to be able to move a marker dynamically, but calling
Marker.setLatLng() seems to leak memory when I call it repeatedly.

The following cut down example mxml leaks about 500k per second, when
run at 30fps:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
        xmlns:mx="http://www.adobe.com/2006/mxml";
        layout="absolute"
        enterFrame="onEnterFrame(event)">
        <maps:Map
                xmlns:maps="com.google.maps.*"
                id="map"
                mapevent_mapready="onMapReady(event)"
                mapevent_mappreinitialize="onMapPreinitialize(event)"
                width="640"
                height="480"
                key="my-api-key"/>
        <mx:Script>
                <![CDATA[
                        import com.google.maps.LatLng;
                        import com.google.maps.MapType;
                        import com.google.maps.MapOptions;
                        import com.google.maps.overlays.Marker;

                        private var marker:Marker = null;

                        private var mapCentre:LatLng = new LatLng(-33.8804, 
151.1912);

                        private function onMapPreinitialize(event:Event):void
                        {
                                var mapOptions:MapOptions = new MapOptions();
                                mapOptions.zoom = 20;
                                mapOptions.center = mapCentre;
                                mapOptions.mapType = MapType.SATELLITE_MAP_TYPE;
                                this.map.setInitOptions(mapOptions);
                        }

                        private function onMapReady(event:Event):void
                        {
                                marker = new Marker(mapCentre);
                                this.map.addOverlay(marker);
                        }

                        private function onEnterFrame(event:Event):void
                        {
                                if (marker != null)
                                        marker.setLatLng(mapCentre);
                        }
                ]]>
        </mx:Script>
</mx:Application>

The leak occurs in both IE7 and firefox 3.

Is it something I am doing wrong?

Thanks,
Saxon

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