Hi all,
I’m trying to recreate thumbnail scrolling as on this template:
http://www.dynamicfactory.us/xmlswfdemo/dynamicv9b/index.html
it involves resizable window and very neat delay efect. I find this thumbnail viewing very precise and effective depending on where your mouse is, anyway so far I’m somewhere here:
http://www.maciejstec.com/test/
hopeless, as it either goes too far or not far enough, I know there must be an easy way to do it, but I can’t seem to find it, here’s my code responsible for scrolling:
[FONT=Arial Narrow]
onEnterFrame = function () {
if(_xmouse>mask_mc._x and _xmouse<mask_mc._x+mask_mc._width and _ymouse>mask_mc._y and _ymouse<mask_mc._y + mask_mc._height){
var s;
s= slider_mc._width - mask_mc._width;
mPerc = _xmouse/(mask_mc._width);
slider_mc._x += (-s*mPerc-slider_mc._x)/5;
}
}[/FONT]
I assumed you have to take a percentage position of mouse as the windows are resizable and it should be a minus value of a mouse position for the slider_mc plus some margins on the beginning and end… anyway, help!!! I’m runing in circles…
note:
slider_mc is a movie clip with all thumbnails in it, it’s width depends on the number of thumbnails loaded from xml…
mask_mc is simplya window to view the thumbnails that needs to be scaled as the browser window is extended/shrinked
here’s a scaling part of script:
[FONT=Arial Narrow]
stop();
Stage.scaleMode = “noScale”;
var HPositioner:Number = (Math.round((Stage.width - 800) / 2));
var VPositioner:Number = (Math.round((Stage.height - 600) / 2));
function HPositionCubes () {
if (Stage.width >= 801) {
var HPositioner:Number = (Math.round((Stage.width - 800) /2));
setProperty(topLeftCube_mc, _x, 0 - HPositioner);
setProperty(mask_mc, _x, 0 - HPositioner);
setProperty(maskframe_mc, _x, 0 - HPositioner);
setProperty(bottomRightCube_mc, _x, (800 + HPositioner) - 89);
} else {
setProperty(topLeftCube_mc, _x, 0);
setProperty(mask_mc, _x, 0);
setProperty(bottomRightCube_mc, _x, 800 - 89);
}
}
function VPositionCubes () {
if (Stage.height >= 601) {
var VPositioner:Number = (Math.round((Stage.height - 600) /2));
setProperty(topLeftCube_mc, _y, 0 - VPositioner);
setProperty(bottomRightCube_mc, _y, (600 + VPositioner) - 84);
} else {
setProperty(topLeftCube_mc, _y, 0);
setProperty(bottomRightCube_mc, _y, 600 - 84);
}
}
HPositionCubes();
VPositionCubes();
[/FONT][FONT=Arial Narrow] setProperty(bg_mc, _width, (Stage.width0.3));
setProperty(bg_mc, _height, (Stage.width0.3));
setProperty(mask_mc, _width, Stage.width);
setProperty(maskframe_mc, _width, Stage.width);
[/FONT][FONT=Arial Narrow] var resizeListener:Object = new Object();
Stage.addListener(resizeListener);
resizeListener.onResize = function () {
setProperty(bg_mc, _width, (Stage.width0.3));
setProperty(bg_mc, _height, (Stage.width0.3));
setProperty(mask_mc, _width, Stage.width);
setProperty(maskframe_mc, _width, Stage.width);
HPositionCubes();
VPositionCubes();
}[/FONT]