Changeset 503

Show
Ignore:
Timestamp:
03/07/08 12:35:16 (9 months ago)
Author:
allens
Message:

- added MarkerClip?.setMarkerLocation()
- added some additional request cleanup to LoadMovieThrottledRequest? and AbstractImageBasedMapProvider?. This should ensure that tile requests are properly garbage collected after they've completed a response.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/as3/lib/com/modestmaps/core/MarkerClip.as

    r483 r503  
    88        import com.modestmaps.Map; 
    99        import com.modestmaps.events.MapEvent; 
    10         //import com.modestmaps.events.MarkerEvent; 
    1110        import com.modestmaps.geo.Location; 
    1211         
     
    105104            public function getMarkerLocation( marker:DisplayObject ) : Location { 
    106105                return locations[marker]; 
     106            } 
     107             
     108            public function setMarkerLocation(marker:DisplayObject, location:Location):void 
     109            { 
     110                locations[marker] = location; 
    107111            } 
    108112             
  • trunk/as3/lib/com/modestmaps/io/LoadMovieThrottledRequest.as

    r447 r503  
    8686                        if (_loader) 
    8787                        { 
    88                                 /* 
     88                _loader.contentLoaderInfo.removeEventListener(Event.INIT, onSpriteLoaded); 
     89                // _loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onLoaderProgress); 
     90                _loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError); 
     91                _loader.contentLoaderInfo.removeEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus); 
     92 
     93                /* 
    8994                                 * FIXME: there must be a better way to know if the Loader has an open connection. 
    9095                                 * For now, we'll just try to close it and catch the exception if it hasn't been 
  • trunk/as3/lib/com/modestmaps/mapproviders/AbstractImageBasedMapProvider.as

    r447 r503  
    1616{  
    1717        import com.modestmaps.core.Coordinate; 
     18        import com.modestmaps.events.ThrottledRequestErrorEvent; 
     19        import com.modestmaps.events.ThrottledRequestEvent; 
    1820        import com.modestmaps.io.MapProviderPaintThrottledRequest; 
    19         import com.modestmaps.events.ThrottledRequestEvent; 
     21         
    2022        import flash.display.Sprite; 
    21         import com.modestmaps.events.ThrottledRequestErrorEvent; 
    2223        import flash.events.ErrorEvent; 
    2324         
     
    5354                        // createLabel(sprite, coord.toString()); 
    5455                } 
    55          
     56 
     57        protected function removeRequestListeners(request:MapProviderPaintThrottledRequest):void 
     58        { 
     59            if (request) 
     60            {    
     61                request.removeEventListener(ThrottledRequestEvent.REQUEST_ERROR, onRequestError); 
     62                request.removeEventListener(ThrottledRequestEvent.RESPONSE_COMPLETE, onResponseComplete); 
     63                request.removeEventListener(ThrottledRequestEvent.RESPONSE_ERROR, onResponseError); 
     64            } 
     65        } 
     66         
    5667                /* 
    5768                 * Returns the url needed to get the tile image.  
     
    7081                protected function onRequestError(event:ThrottledRequestEvent):void 
    7182                { 
     83                    removeRequestListeners(event.target as MapProviderPaintThrottledRequest); 
    7284                    paintFailure(event.sprite); 
    7385                } 
     
    7890                protected function onResponseComplete(event:ThrottledRequestEvent):void 
    7991                { 
     92            removeRequestListeners(event.target as MapProviderPaintThrottledRequest); 
    8093                        raisePaintComplete(event.sprite, event.coord); 
    8194                } 
     
    8699                protected function onResponseError(event:ThrottledRequestErrorEvent):void 
    87100                { 
     101            removeRequestListeners(event.target as MapProviderPaintThrottledRequest); 
    88102                        if (event.sprite) 
    89103                        {