You should be able to simply do these lines:
addOverlay(encodedPolyline);
var bounds:LatLngBounds = encodedPolyline.getLatLngBounds();
setCenter(bounds.getCenter());
setZoom(getBoundsZoomLevel(bounds));

Does that not work for you? - pamela

On Tue, Sep 2, 2008 at 8:20 AM, 123gotoandplay <[EMAIL PROTECTED]> wrote:
>
> hi all,
>
> how do i get the bounds with EncodedPolylineData and center the map
> around the polyline ??
>
> i tried
> [code]
> private function onMapReady(event:MapEvent):void {
>        //our polypoints as flashvars
>         var flashVars:Object = LoaderInfo(this.root.loaderInfo).parameters;
>         var sTitle:String = flashVars.sTitle;
>         var sDescr:String = flashVars.sDescr;
>         openInfoWindow(getCenter(), new InfoWindowOptions( { title: sTitle,
> content: sDescr } ));
>
>         /*
>          * Add an encoded polyline.
>          */
>    var encodedPoints:String = flashVars.aMapPoints;
>    var encodedLevels:String = flashVars.sMapLevel;
>
> var encodedPolyline:Polyline = Polyline.fromEncoded(
>      new EncodedPolylineData(encodedPoints, 32, encodedLevels, 4),
>      new PolylineOptions({ strokeStyle: new StrokeStyle({
>        color: 0x0000ff,
>        thickness: 4,
>        alpha: 0.7})
>      }));
>
>        /*center around route*/
>        var bounds:LatLngBounds = encodedPolyline.getLatLngBounds();
>        var n:Number;
>        for (n = 0 ; n < encodedPoints.length-1; n++) {
>                        bounds.extend(encodedPoints[n]);
>        }
>        setCenter(bounds.getCenter());
> /*end center around route*/
>    addOverlay(encodedPolyline);
>
>  }
> [/code]
>
> the /*center around route*/ part doesn't work?
>
> 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