Zooming In/Out in Flash Based web maps.

Careless

Posted 20 April 2007 - 04:28 PM

Careless

Newbie

Validated Member

6 posts

Canada

Hi everyone,

I'm about 5 hours into coding the actionscript for the flash map (I've not coded flash in 2 years, so it's taken me a while to get the hang of it again)... I've run into a snag with the zooming function of the website. I dont know of any better way to do it, so I'm using scale function and a bunch of custom flag vars to indicate the depth of zoom and whatnot.

I'm having trouble with the part where the area of focus (center of the square) is always being pushed outward as you zoom in, due to the fact that the scaling of any object is done by pushing out the corners, so in turn, the target area gets pushed out as well, and you lose your spot on the map.

Also, I've not yet figured out a way to do map bounds so that it does not let you go passed the edges of the map.

Please keep in mind that parts of the map will have to be able to be turned off and such.. like routes and roads.

benbakelaar

Posted 20 April 2007 - 11:19 PM

Regarding zooming and keeping the center, you will notice that Google Maps does not correct for this.

If you want to keep it centered, I would suggest to calculate the center of the viewport at time of zoom click, and then recenter the map after you zoom in. You can do this using screen, bound, or lat/lng coords. But since you do not have click-and-drag functionality for panning on the map, I think this might confuse the user anyway.

BTW great script! I would love to get my hands on the code ActionScript is a beast.

Careless

Posted 23 April 2007 - 09:47 AM

Careless

Newbie

Validated Member

6 posts

Canada

Regarding zooming and keeping the center, you will notice that Google Maps does not correct for this.

If you want to keep it centered, I would suggest to calculate the center of the viewport at time of zoom click, and then recenter the map after you zoom in. You can do this using screen, bound, or lat/lng coords. But since you do not have click-and-drag functionality for panning on the map, I think this might confuse the user anyway.

BTW great script! I would love to get my hands on the code ActionScript is a beast.

thanks =)

how would i find these screen/bound functions. I've searched for them before, but came back with little to nothing in terms of useable actionscript. the coders seem to have made their versions too hard to strip.

And what version of flash does bound/screen take effect? the nav controls on the side are using flash 6.0 actionscript 1.0 coding, so, im not sure if i would have to find out how to recode that to work for flash8 or whatever.

Careless

Posted 01 May 2007 - 02:54 PM

i found out that the best way to do this is to have a "ZOOM" Layer, that stays put and is enlarged every time you click the in our out buttons.

and within the zoom layer, put a "MAP" Layer that has all the movie clips that contain all the levels of mapping that you need (water, roads, buildings, highways, parks and rec).

on your navigation (N,E,S,W) you would make it move the MAP layer. that way when you ZOOM in, the ZOOM layer which contains the MAP layer is still zooming in the center, and the MAP layer is the one that moves around, not the ZOOMING layer itself.

make sense to everyone?

I would upload the code, but I am not the originator of some of it, and it's under my companies privacy policy to withold scripts that have been paid for from a third-party.

skolapper

Posted 04 September 2009 - 07:59 PM

skolapper

Newbie

New Member

1 posts

Location:Senegal

Interests:Soccer

No Country Selected

Does anyone have any suggestions for good flash forums where I can find flash designers to help me with a flash animation? It has been a hit-and-miss here in the sitepoint marketplace. Looking for more of a dedicated group of flash designers. Thanks.

DonovanK

Posted 10 March 2011 - 04:24 PM

DonovanK

Newbie

Validated Member

5 posts

United States

This is one thing I hate about Google maps. It does the same thing. I basically have to center the map every time I zoom in or out. You would think there would be a lock function to where you could point to a certain point on the map to center it and then lock it. But I guess if Google can't do it then it's not possible.

sascha88

Posted 12 August 2011 - 03:22 AM

sascha88

Newbie

New Member

1 posts

United States

This is one thing I hate about Google maps. It does the same thing. I basically have to center the map every time I zoom in or out. You would think there would be a lock function to where you could point to a certain point on the map to center it and then lock it. But I guess if Google can't do it then it's not possible.