I cannot get my head around this one…I want to create a feature that zooms in on the map…and the selected booth is centered in the main viewing window…what I have come up with right now only works really crappy…the more times you click on an exhibitor in the list, the closer to the center the map comes…can anyone help me out?
www.expocadvr.com/new/default.html
function listClick(boothArr:Array)
{
//trace(boothArr);
//_root.scaleTo(120);
/*for(var i=0; i<boothArr.length; i++)
{
var myPoint:Object = {x:booths[booth].xValue, y:booths[booth].yValue};
var booth:Number = boothArr*;
//trace(.globalToLocal());
//trace(.globalToLocal());
_root.target._visible = true;
_root.target.localToGlobal(myPoint);
_root.target._x = booths[booth].xValue.localToGlobal();
_root.target._y = booths[booth].yValue.localToGlobal();
}*/
for(var i=0; i<boothArr.length; i++)
{
var booth:Number = boothArr*;
var myPoint:Object = {x:0, y:0};
var myPoint2:Object = {x:0, y:0};
//var myPointX:Object = {x:0, y:0};
//var myPointXX:Object = {x:0, y:0};
_root.container.localToGlobal(myPoint);
_root.hitAreaMain.localToGlobal(myPoint2);
//booths[booth].localToGlobal(myPointX);
//_root.container.localToGlobal(myPointXX);
var centerMapX:Number;
var centerMapY:Number;
var centerWinX:Number;
var centerWinY:Number;
var offsetX:Number;
var offsetY:Number;
var boothX:Number;
var boothY:Number;
var moveX:Number;
var moveY:Number;
var distX:Number;
var distY:Number;
distX = ((_root.container._width/2) - booths[booth].xValue)*_root.theScale;
distY = ((_root.container._width/2) - booths[booth].yValue)*_root.theScale;
offsetX = myPoint2.x - myPoint.x - _root.zoomChangeX;
offsetY = myPoint2.y - myPoint.y - _root.zoomChangeY;
trace(distX + " " + distY);
/*
centerMapX = (myPoint2.x+((_root.container._width/2)*_root.theScale))+offsetX;
centerMapY = (myPoint2.y+((_root.container._height/2)*_root.theScale))+offsetY;
*/
centerWinX = myPoint2.x + (_root.hitAreaMain._width/2);
centerWinY = myPoint2.y + (_root.hitAreaMain._height/2);
boothX = (booths[booth].xValue*_root.theScale)+myPoint2.x;
boothY = (booths[booth].yValue*_root.theScale)+myPoint2.y;
//trace(centerMapX + " " + centerMapY + " " + centerWinX + " " + centerWinY);
//trace(boothX + " " + boothY);
moveX = (distX + offsetX);
moveY = (distY + offsetY);
trace(moveX + " " + moveY);
//trace(_root.container._width + " " + _root.container._height);
//trace(myPoint.x + " " + myPoint.y);
//trace(booths[booth]);
//trace(booths[booth] + " " + myPointX.y);
//trace(booths[booth].xValue + " " + booths[booth].yValue);
//tempX = (myPoint2.x - myPoint.x)+(_root.hitAreaMain._width/2);
//tempY = (myPoint2.y - myPoint.y)+(_root.hitAreaMain._height/2);
//moveX = tempX - boothX - (booths[booth].boothWidth/2);
//moveY = tempY - boothY - (booths[booth].boothHeight/2);
_root.checkBounds(moveX, moveY, 0, 0);
}
}
this function is called when an item in the list is clicked…