I'm trying to manage my memory in a flex application.

I have a tree with a map in each of several nodes.  The maps are
initiated within their own canvas as a UIComponent.

<gm:GoogleMaps id="googlemapbrowse"
 initialize="{googlemapbrowse.startMap(event)}"
 resize="{googlemapbrowse.resizeMap(event)}"
 width="100%" height="80%"
  x = "0" y="20"
 />

Where the GoogleMaps class is an extension of the UIComponent.

public class GoogleMaps extends UIComponent
{

public function startMap(event:Event):void {
        map = new Map();  map.key=
"ABQIAAAA_8ut_QO3UD07y6Ch_GqXLRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTzkWT4H53MxSvbUk62bf1yl62ypg";
                map.addEventListener(MapEvent.MAP_READY, onMapReady);
               this.addChild(map);
}
public function resizeMap(event:Event):void {
                map.setSize(new Point(this.width, this.height));
}
private function onMapReady(event:Event):void {
                map.enableScrollWheelZoom();
                map.enableContinuousZoom();
                map.addControl(overview);
                overview.setSize(new Point(165,165));
                overview.setControlPosition(new
ControlPosition(ControlPosition.ANCHOR_BOTTOM_RIGHT,2,2));
                map.setCenter(new LatLng(-33.87205, 151.203874),14,
MapType.NORMAL_MAP_TYPE);
                map.setCenter(new LatLng(-33.87205, 151.203874));
        map.setZoom(14);
        map.addControl(zoomcontrol) ;
        map.closeInfoWindow();
}


When I do this,  I'm getting the horizontal bar on my vertical zoom
control duplicating.   When I zoom in and out I get two bars only one
of which can be moved to change the zoom.  This is really odd.  When I
fire my application up it reliably has duplicate bars the first time.
When I shut down firefox and clear the cache then open it has only one
bar.  If I shut down and start again it has two.  This alternates when
I shut down and clear.


My other problem is due to memory management.   I'm setting the map to
null.  Using actionscript at somepoint.
E.g.
this.googlemapbrowse = null.

I'm later re-instantiating.
e.g.
googlemapbrowse = new GoogleMap();
googlemapbrowse.startMap(event);
googlemapbrowse.resizeMap(event);

Unfortunatly this doesn't work and I get a null pointer error when I
fire off the geocode in this map.


Any ideas?


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