[Actionscript 2] NEED HELP with scrolling and zooming for a map!

[EDIT]
Ok. I fixed the zoom problems, Thanks a lot for the help!!! The only problem that I have left if the scrolling. I’ll explain the situation again since it may have been confusing before.

The problem is with the four arrows to move trough the map. Right now the code I have allows me to move trough the map, but I can’t set a limit. I want to be able to move trough the map and stop once the border of the image reaches the stage border, so that the image won’t keep moving indefinitely.

So I nee to put something like

on release, move UNTIL a certain limit (when the border of the image is reached, since keep moving after that would be pointless).

I’m not sure if that clarified things or not, anyway, thanks for the help so far, I really appreciate it!!!


Hi There!!! :wave:

I’m sorry if I’m asking something that was already asked. I’m working on a little thing in flash that will show a map. The map is too big and I want for the people seeing it to be able to zoom in on the details, that why I added a zoom option (just a little scale thing) a button with this code (map 2 is the movieclip with the map);

on (press) {
_root.map2._xscale -=20
_root.map2._yscale -=20
}
(This is for Zoom out and for Zoom in is the same code but with + instead of -)

My first problem is that I don’t know how to put a limit, if I click enough times the scale will descend until negative numbers and the image will flip. I’d like to find a way for it to stop at a determined size.

Also since the zoom in expands the image (like it should) passing the limits of the stage I wanted to add a way to scroll or somehow move the image to see it all once it’s big. I try to create a scrollbar that was activated when the pic surpasses the size of the stage, but I was unsuccessful.

I read on a forum another option of putting 4 arrows to move in the fourth directions. I like the idea, but again I need to put limit so that the image stop moving once it reaches it’s border (limit). The idea if to prevent the image from "escaping the screen, so it would only move the image enough to see it all and not more.

The code on each arrow is a variation from this:

on(release){
if (_root.map2._width >= 400) {
_root.map2._x += 50;
}
}
(In this case is the one for the west, for the other options the the + can change for a - and the x and width options will change for y and height)

“_root.map2._width >= 400” is to make sure that the moving is going to be available only when the size of the image exceeds the size of the stage, but I’m stuck on the other part. Can anyone help me?

Thanks

xelloss100

P.D. I’m not sure if I’m explaining the situation well, if not please ask and I’ll do my best to clarify.