visit http://ostari.com/ronnie/airbox
Notice my scrolling thumbnail list at the bottom is getting centered (the registration point is getting centered). Now if you resize it, it gets positioned the way it should be. I’ve been sifting through this code trying different stuff but I cant seem to get it. Anyone see something that stands out? I tried commenting out just about every one of those “/2” lines and still no good.
updateLocations = function () {
initialWidth = Stage.width;
initialHeight = Stage.height;
currentWidth = Stage.width;
currentHeight = Stage.height;
contentWidth = thumbSlider._width;
if (thumbSlider._width<currentWidth) {
newX = Math.round(initialWidth/2-thumbSlider._width/2);
} else {
positionContent();
newX = Math.round(initialWidth/2-thumbSlider._width/2);
}
};
updateLocations();
//the amount of space on each edge
buffer = 600;
this.onMouseMove = function() {
if(windowUp == "false") {
if ((this._xmouse>Math.floor((initialWidth-currentWidth)/2)) && (this._xmouse<Math.floor(initialWidth+2*((currentWidth-initialWidth)/2))) && (this._ymouse>thumbSlider._y) && (this._ymouse<(thumbSlider._y+thumbSlider._height))) {
if (thumbSlider._width>currentWidth) {
positionContent();
}
}
}
};
positionContent = function () {
mousePercent = (this._xmouse+(currentWidth-initialWidth)/2)/currentWidth;
availMovement = thumbSlider._width-currentWidth+buffer*2;
newX = Math.floor(-mousePercent*availMovement)-(currentWidth-initialWidth)/2+(buffer*2)/2;
};
if (thumbSlider._width>currentWidth) {
newX = Math.floor((initialWidth-currentWidth)/2)+buffer;
} else {
newX = Math.floor(initialWidth/2-thumbSlider._width/2);
}
holder = thumbSlider._x;
easeContent = function () {
if (newX<>thumbSlider._x) {
destx = newX;
posx = holder;
velx = (destx-posx)/4;
holder += velx;
thumbSlider._x = Math.round(holder);
}
};
thumbSlider.onEnterFrame = function() {
easeContent();
};
updateLocations();