dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: cant think of a good(clean) title for this one..

  1. #1
    Senior Member
    Join Date
    Nov 2007
    Posts
    207

    cant think of a good(clean) title for this one..

    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...
    code:

    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...

    code:

    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?

  2. #2
    Senior Member
    Join Date
    Nov 2007
    Posts
    207
    my bad here is the link to try it for youself...

    http://www.expocadvr.com/new/default.html

  3. #3
    Senior Member
    Join Date
    Mar 2008
    Location
    England
    Posts
    159
    Could u post the .fla file or whatever cause then we can see for ourselbes!
    Thanks
    Rhys

  4. #4
    Senior Member
    Join Date
    Nov 2007
    Posts
    207
    there are way too many xml files associated with this project for me to send them all...the relevant code is in my post above...if you have any questions I would gladly provide any more information you may need...plus I think if you saw my FLAs you would say my code is the problem =)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center