This content has been marked as final. Show 8 replies
change your onMouseUp handler to:
Thanks for responding but No that didn't fix it. It still zooms but not to the area I drew the rectangle over.
make sure your map has its registration point in the upper left and it's located at 0,0 to start or adjust the _x,_y for your start point.
I changed the registration to upper left but did not understand this very well:
quote:and perhaps that is why it still does not work well. Depending on how many times I zoom and where I start drawing the rectangle, the zoom does not work as expected. Maybe I should attach the fla, but how do I do that here?
and it's located at 0,0 to start or adjust the _x,_y for your start point.
I had three problems when I tried kglad's onMouseUp suggestion: first, the _xscale and _yscale were different so the movieclip got distorted after the zoom; secondly, it only worked when I drag the zoom rectangle from top left and third it works only on the first zoom but not subsequent ones. I managed to fix the first two but now stuck with the third. Somehow on subsequent zooms something needs to be reset. Help appreciated. Here is the full code so far:
Hey, kudos on your code so far! You've come a long way already.
> first, the _xscale and _yscale were different so the movieclip got
> distorted after the zoom; secondly, it only worked when I drag the
> zoom rectangle from top left and third it works only on the first
> zoom but not subsequent ones. I managed to fix the first two but
> now stuck with the third.
Based on what I'm seeing, that third problem makes sense. Essentially, you're starting from scratch every time, because you're deriving your scale from the height and width of the Stage, as compared with the drawn rectangle, when the mouse is released. In order to *keep* zooming, I believe you'll have to rethink that ratio variable, theScale.
Off the top of my head, I thinking you may need to compare the size of the zoom rectangle to the width and height of the Africa movie clip, not the Stage. As Africa's scale changes, you'll have to compensate your zoom rectangle measurements to decide how to zoom it further.
Does that make sense? Too vague? I can "see" an approach in my head, but to test it out and really elaborate, I'd have to put together a sample file. Unfortunately, the past several days have been pretty hectic for me.
I know you offered to provide your FLA, but I really like to go minimalist when trying to solve a problem: new FLA, only the elements that pertain to the problem. Clean slate sort of thing. Have you tried that, maybe? It often helps to "take a breather" of sorts and start over in a fresh document, without the clutter or emotional baggage of an existing project.
Completely off topic: I happen to be logged in to these forums via the browser interface (very rare for me, because I prefer to use a news client). Because of this, I forgot to include my usual signature -- but I see that the forum has recognized me anyway. Funny part is, it says this is my first post, and that I joined late in 2005.
I feel young again! :)
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."
Did this issue ever get sorted, I've got myself to this exact spot and now I'm stuck.