If (multiple conditions?) {

I’ve got a zoomable map within a frame, and of course I don’t want it to be dragged out of view, right?

So, how do I set the startDrag (L,T,R,B) parameters when it’s a different size when it’s enlarged (zoomed)?

Would it be advisable to somehow set multiple conditions to do something like this? (if so, how would I do it?)

[FONT=Courier New]
if ( between Size>100 AND Size<200) {
startDrag(this, false,400,150,600,250);
if ( between Size>200 AND Size<400) {
startDrag(this, false,500,250,500,150);

Would it be advisable to do something like that? If so, how would I code it?
If not, what would be a better idea?

…I swear, adding this zoom feature added a whole level of complexity to this map that I’ve never imagined. PLEASE HELP!


alright, here would be my take on the situation.

You can achieve this with one if statement, here’s how:

If there’s a region you want to test the mouse in, all you need to know is that region and the scaling of the map (100%, 50%, 75%, etc).

Say the region to be dragged is from -50px to 50px at 100% zoom. If you zoom out at 50%, the region becomes -25 to 25 (this is all relative, btw). Now you can apply this to an if-statement like so:

if (between Size > 100zoom% AND Size < 200zoom%) {
//…follow suit with the startDrag()

This is all assuming, of course, that I know what you’re talking about. :whistle:

That’s a good suggestion. If were were to use that solution, wouldn’t we have to define what the value of the current zoom is?

For example, what if I pressed zoom twice? Each time I pressed zoom, I’d have to increment a value, and use that value to add to all the drag sizes like you mentioned, right? I’m no pro, and I’m totally guessing. I think your idea could work, I’m just not sure how to implement it, or what the code would look like. Am I on the right track?

That’s exactly how you’d do it. Keep track of what the map’s zoom is and you’re set to go.

You can even save yourself the trouble by finding out the zoom factor from anywhere: simply refer to the _xscale and _yscale property of the map (MovieClip). If a MovieClip is scaled to 100% the _xscale and _yscale values of that clip will be 100. 50%, 50 for each, etc. You can mess with the individual values to scale each dimension separately.

if you want to know more about if statements: http://www.kirupaforum.com/forums/showthread.php?t=60750