Map Handling Take 3 – Hover Over Borders (AS3)
Well, at the risk of sensory overload today – it’s my blog after all – I decided to post one more version of my map handler. This one adds in the classic mouse hover scroll effect at the edges of the map. I did try to make it a bit more usable, though, by calculating the distance from the edge of the map and accelerating the movement appropriately. So, the closer to the edge you are, the faster the map scrolls. So, to recap, you can use the following methods to move:
- A, S, D and W
- Click the location on the map preview where you want to zoom
- Click and drag the viewport preview to quickly pan the map
- Hover over the edges of the map itself to scroll
Obviously, for a released title, I would want to replace the cursor icons with arrows upon the hover scrolling and other cleanup things as well, but just toying with concepts right now.
Thoughts?
Garth Henson has been working professionally as a web developer for nearly 10 years. When not coding in PHP, JavaScript or Actionscript, he can usually be found trying to refine his photography skills.






Mark Johnson
6 May, 2009
Looking great Garth!
Justin Gerard and I where working on a tile based strategy game a while back and could use a solution like this. Haven’t had time to work on it recently but here’s what we were working on if you’re interested:
http://www.portlandstudios.com/tiledemo/ – click the tanks to move
http://www.portlandstudios.com/tiledemo/MapSlab.html – an attempt to render realistic looking terrain (click to add trees, space > click to add craters)
We should team up on a game sometime!
Oleg
22 Dec, 2009
Hi!
It’s great !
But I see some mistake.
When you target MouseOver in PreviewMap (y=-10) marker (rectangle) move up, it`s like in GeneralMap navigation.
Sorry for my English.