I have a math roadblock, and was wondering if anyone can help me out here. I'll try to explain.

In 2 consecutive frames, I've placed 2 versions of the same street map:

In frame 1:
* 1x zoom factor (zoomed out -- detail not so vivid)
* map size 2128w x 1797h

In frame 2:
* 2x zoom factor (zoomed in -- lots of detail)
* map size 4256w x 3593h

Now, both of the maps are big, but on each frame I've placed a mask layer onto the stage to make only part of it visible. (The mask is a 776x452 rectangle, and its upper left corner is perfectly aligned with the stage corner at (0,0).) By pressing the mouse over the map, users can drag it within that mask window and reveal any portion of it. On my stage I've also placed "zoom" buttons that let users toggle between the two sizes (e.g. jumping from frame 1 to frame 2 switches map zoom factor from 1x to 2x).

The .swf is pretty big, and I've actually simplified the problem for this posting, so if at all possible I'd like to avoid having to post anything. I hope this is clear so far!

OK, now the fun math part: Let's say I'm looking at the map in frame 1 (1x zoom factor). Let's also say I've dragged it around on the stage because I want to find the location of my house. Having done that, I position my house (represented by some (x,y) coordinate) in the _exact center_ of my view window -- i.e. at stage coords (776/2,452/2) or (388,226)....

NOW, I'd like to zoom in and get a closer look at my house, so I would hit the button that takes me from frame 1 (1x zoom) to frame 2 (2x zoom). In theory, I should now be able to see my house, plus a smaller radius of surrounding environs, in closer detail. And my house should still be positioned on the center coordinate within the view window.

If you sketch this on paper, you'll see that for my house's (x,y) coords to remain positioned in the center of the view window on both maps, the upper-left corner (x,y) coords of the full maps (imagine that there's no mask and you can see entire maps laid out in front of you, spilling beyond the edges of the stage) will vary depending on the zoom factor. Initially, when I first located my house in frame 1, the corner coords for the 1x zoom map were positioned at some location (ax,ay). Then, after I zoomed into the 2x map in frame 2, the map is now twice as big, so its corner coords (bx,by) have shifted upward and to the left some amount.

I'm looking for the forumula that converts (ax,ay) to (bx,by). It should be in a general form that says:

bx = ax (with the application of some genius math magic)
by = ay (with the application of some genius math magic)

Remember: x and y coords in this case refer to the upper lefthand corner position of the maps on the stage. In my example above, if by some amazing coincidence my house happened to be located on the 1x map such that its position aligned exactly with the center view window coords (388,226), then the corner (ax,ay) coordinates -- for both the map and stage -- would be (0,0). To zoom in on my house in that position, while keeping my house in the center of the view, the 2x map's corner (bx,by) coords would be offset into negative x and y vales, because the map grew in size and its upper left corner has overflowed off the stage.

One final clarification: I am indeed using two separate map files for this, as opposed to one single hi-res map whose _scale is adjusted down by a zoom factor variable. Sadly, I had to do this because altering _scale distorts the map detail.

Hope this makes sense! Glad to clarify if I've muddied the waters....