Image Zoom and Pan on Rollover
Hi all,
I was wondering if anyone has any suggestions on setting something like this up. I'm not very good at programming, I'm trying to modify this code to work on rollOver instead of onClipEvent (mouseDown). I also want to stay zoomed in on rollOver and be able to pan around the zoomed image. Then, when I mouse out have it return to normal position.
onClipEvent (mouseDown) {
if (k>0) {
return;
}
zoom = true;
dir == 1 ? (dir=-1) : (dir=1); // i understand that this sets
//zooming in and out
if (dir == 1) { //this set zooming in position on mouseDown
pt = {x:_root._xmouse, y:_root._ymouse};
}
}
onClipEvent (enterFrame) {
if (!zoom) { //test for if zooming is true
return;
}
_root._xscale += dir*k*50/8; //this controls image zoom in/out
//depending on direction
_root._yscale += dir*k*50/8;
var pt2 = {x:pt.x, y:pt.y};
_root.localToGlobal(pt2);
_root._x -= (pt2.x-pt.x);
_root._y -= (pt2.y-pt.y);
k++; //this is the counter for animating the zoom
if (k == 8) {
zoom = false;
k = 0;
}
}
I think that I'd need to make my image a button and perhaps move the onClipEvent (mouseDown) script to the button as on (rollOver). I was thinking I'd have to set some global variables to make that work with this script.
One day I'll take a programming class and get this stuff down.
|