private var googleMap:Map;
private var mapBounds:LatLngBounds;
private function init(): void
{
googleMap = new Map();
googleMap.key = "key";
googleMap.addEventListener(MapEvent.MAP_READY,
onMapReady);
googleMap.addEventListener(MapMoveEvent.MOVE_STEP,
onMapMoveStep);
mapContainer.addChild(googleMap);
}
private function onMapMoveStep(e:MapMoveEvent): void
{
checkBounds();
}
private function onMapReady(e:MapEvent): void
{
mapBounds = new LatLngBounds(new LatLng(49.5,-10), new
LatLng(59,2.6));
googleMap.setCenter(new LatLng(54.622978,-3.065186), 7,
MapType.HYBRID_MAP_TYPE);
googleMap.enableScrollWheelZoom();
}
private function checkBounds(): void
{
if (mapBounds.containsLatLng(googleMap.getCenter()) ==
false)
{
var c:LatLng = googleMap.getCenter();
var x:Number = c.lng();
var y:Number = c.lat();
var maxX:Number =
mapBounds.getNorthEast().lng();
var maxY:Number =
mapBounds.getNorthEast().lat();
var minX:Number =
mapBounds.getSouthWest().lng();
var minY:Number =
mapBounds.getSouthWest().lat();
if (x < minX)
{
x = minX;
}
if (x > maxX)
{
x = maxX;
}
if (y < minY)
{
y = minY;
}
if (y > maxY)
{
y = maxY;
}
googleMap.setCenter(new LatLng(y, x));
trace(new LatLng(y, x));
}
}
Not sure if this is right or not, it works for me :D Good thing is
that this example caters exactly to what i was wanting to achieve. the
UK :D
On Jul 23, 11:19 pm, "pamela (Google Employee)" <[EMAIL PROTECTED]>
wrote:
> Hi RJ-
>
> Re panning- maybe you can port this solution from JS to
> AS3?http://econym.googlepages.com/example_range.htm
>
> It works pretty well for JS. Let me know if there are issues with it.
>
> A funny thing I saw a developer do once was paint the tiles outside
> the region with "Yar! There be dragons here!". I always thought that
> was cute. :)
>
> - pamela
>
> On Jul 19, 3:19 pm, rjcarr <[EMAIL PROTECTED]> wrote:
>
> > I'm using custom tiles that only cover a specific geographic region.
> > I don't have as many resolution levels as the google maps do either
> > but I'd like to have at least one google tile set in my application.
>
> > I'd like tolimitthe position and zoom but can't quite figure it
> > out ... here are my thoughts:
>
> > o For zoom I'm pretty sure I could figure it out. Either I could
> > edit the zoom capabilities of the built-in maps or if that won't work
> > just create my own zoom control. No big deal.
>
> > o I haven't seen any api methods to let melimitthe position. For
> > this I might also have to make my own control, but that'd fix the
> > problem. Again, no big deal.
>
> > o The biggest problem I see is the mouse drag panning. I'm sure I
> > could do a snap back to reposition the area once the user stops the
> > mouse pan but is there any way I could stop it mid drag if a boundary
> > is reached? I don't see any way to cancel the events ... am I missing
> > something?
>
> > Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---