Jump to content

 
Photo

Zooming In/Out in Flash Based web maps.

- - - - -

  • Please log in to reply
10 replies to this topic

#1
Careless

Careless

    Newbie

  • Validated Member
  • Pip
  • 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.

Here is a quick link to the progress page.

Northern Ontario Trail Map

#2
benbakelaar

benbakelaar

    Ultimate Contributor

  • Associate Admin
  • PipPipPipPipPipPip
  • 658 posts
  • Gender:Male
  • Location:North Brunswick, NJ
  • Interests:maps, information, technology, scripting, computers
  • United States

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.

#3
Careless

Careless

    Newbie

  • Validated Member
  • Pip
  • 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.

im not the greatest at flash =/

#4
benbakelaar

benbakelaar

    Ultimate Contributor

  • Associate Admin
  • PipPipPipPipPipPip
  • 658 posts
  • Gender:Male
  • Location:North Brunswick, NJ
  • Interests:maps, information, technology, scripting, computers
  • United States

i don't know enough about Flash or Actionscript, but you may want to ask the guy who made this: http://www.backspace.com/mapapp/

he responded to my email a few months ago.

also you should check out http://www.worldkit.org, and you can try asking the developer there or using their message board/forum/listserv, whatever they have.

also i know for me the Google Maps API Discussion Group was really good, so if you search on http://groups.google.com its basically the old Usenet plus new stuff.

#5
Careless

Careless

    Newbie

  • Validated Member
  • Pip
  • 6 posts
  • Canada

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.

Any questions though, please ask.

#6
Careless

Careless

    Newbie

  • Validated Member
  • Pip
  • 6 posts
  • Canada

Hey everyone,

Here's the latest update on the file

http://coa.wireballcreative.net/

anyone know how to get rid of stack errors? one of my layers has 8000 vertices, so i doubt i can export anything. But i have managed to slim down the file (lakes), and use a PNG for the names.

These are all loaded in external SWF files, placed in an external movie clip. This allows me more space per individual layer.

Next on the list is:

Trail Routes for OBR and OTC.
Trail Tooltips for mousing over each trail and seeing which one it is.
and Preloaders with some little dudes riding bikes =)

Then i have to do the SOUTHERN Ontario file. oh gosh =/


any questions....ask away =D

#7
Dilshan

Dilshan

    Newbie

  • New Member
  • Pip
  • 1 posts
  • Sri Lanka

Hey everyone,

Here's the latest update on the file

http://coa.wireballcreative.net/

anyone know how to get rid of stack errors? one of my layers has 8000 vertices, so i doubt i can export anything. But i have managed to slim down the file (lakes), and use a PNG for the names.

These are all loaded in external SWF files, placed in an external movie clip. This allows me more space per individual layer.

Next on the list is:

Trail Routes for OBR and OTC.
Trail Tooltips for mousing over each trail and seeing which one it is.
and Preloaders with some little dudes riding bikes =)

Then i have to do the SOUTHERN Ontario file. oh gosh =/


any questions....ask away =D



Hi Careless

I'm having same problem , still i can not find a solution how to do that ,I think you may find a solution can you please upload a sample code
please

Dilshan

#8
skolapper

skolapper

    Newbie

  • New Member
  • Pip
  • 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.
mee

#9
DonovanK

DonovanK

    Newbie

  • Validated Member
  • Pip
  • 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.

#10
sascha88

sascha88

    Newbie

  • New Member
  • Pip
  • 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.


I' ve read they are working on it :rolleyes:

#11
Paula78

Paula78

    Newbie

  • New Member
  • Pip
  • 1 posts
  • No Country Selected

And to my mind Google maps is great echeviment!! and if it has any cons now, in future they 'll be solved)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->