This one I cant figure out…lol just like the rest of my posts =)
Anyhow…for some reason…when you are all the way zoomed in on the main map…you can drag the minimap selection box outside of the minimap bounds…it stays within the bounds when you are barely zoomed in…and half way zoomed in…but when you get close to all the way zoomed in…or all the way zoomed in…its free to be pulled out of the minimap…I cannot figure out why this is…
here is some code that controls all of this…
zoomMini is the minimap selection area…containerMini is the minimap…and container is the main map…
zoomMini.onPress = function()
{
Mouse.hide();
isDragging = true;
mouseHandDown._visible = true;
mouseHandOver._visible = false;
startDrag("mouseHandDown", true);
ROOT.checkBounds(-containerMini._xmouse, -containerMini._ymouse, container._x, container._y);
this.onMouseMove = function()
{
ROOT.checkBounds(-containerMini._xmouse, -containerMini._ymouse, container._x, container._y);
}
}
here is the checkBounds function called above…
function checkBounds(new_X:Number, new_Y:Number, old_X:Number, old_Y:Number)
{
removePrevTarget(numTargets);
var mc:MovieClip = container;
var clip:MovieClip = hitAreaMain;
var zoomTemp:MovieClip = zoomMain;
var miniWin:MovieClip = miniWin;
var mapBound:Object = zoomTemp.getBounds(this);
var clipBound:Object = clip.getBounds(this);
if(old_X == null)
{
var dx:Number = new_X;
var dy:Number = new_Y;
}
else
{
var dx:Number = new_X - old_X;
var dy:Number = new_Y - old_Y;
}
if(zoomTemp._width > clip._width)
{
if((mapBound.xMin + dx) > clipBound.xMin)
{
dx = clipBound.xMin - mapBound.xMin;
}
if((mapBound.xMax + dx) < clipBound.xMax)
{
dx = clipBound.xMax - mapBound.xMax;
}
}
else
{
dx = mc_X - mc._x;
}
if(zoomTemp._height > clip._height)
{
if((mapBound.yMin + dy) > clipBound.yMin)
{
dy = clipBound.yMin - mapBound.yMin;
}
if((mapBound.yMax + dy) < clipBound.yMax)
{
dy = clipBound.yMax - mapBound.yMax;
}
}
else
{
dy = mc_Y - mc._y;
}
actualMoveX = dx;
actualMoveY = dy;
if(old_X == null)
{
dx *=(100/zoomMain._xscale);
dy *=(100/zoomMain._xscale);
tween_handler = new Tween(mc, "_x", Strong.easeInOut, mc._x, mc._x + dx, .5, true);
tween_handler = new Tween(mc, "_y", Strong.easeInOut, mc._y, mc._y + dy, .5, true);
tween_handler2 = new Tween(miniWin, "_x", Strong.easeInOut, miniWin._x, ((mc._width - miniWin._width) / 2 - (mc._x+dx) - mc._width), .5, true);
tween_handler2 = new Tween(miniWin, "_y", Strong.easeInOut, miniWin._y, ((mc._height - miniWin._height) / 2 - (mc._y+dy) - mc._height), .5, true);
}
else
{
mc._x += dx;
mc._y += dy;
miniWin._x = (mc._width - miniWin._width) / 2 - mc._x - mc._width;
miniWin._y = (mc._height - miniWin._height) / 2 - mc._y - mc._height;
}
}
can anyone see anything that im doing wrong?