# Mouse detection image gallery

[LEFT]help!!:h:

im trying to recreate an image gallery as shown here:
http://flashimagegallery.com/pics/artwork/

basicaly when your mouse moves the image adjusts based on the ratio of the viewing area.

the setup is basicaly a viewing area mc i have called (mMask) and a picture, mc that lays behind it called pichold. these two mc’s are nested within a movie clip called viewgall. im working on this on the side to then bring into another .fla when finished. these heres what i have so far for the code:

init();
function init():Void {
//pic = attachMovie(“pichold”, “pichold”, 0);
pichold._x = centerX;
pichold._y = centerY;
}
function onEnterFrame():Void {
var dx:Number = _xmouse-centerX;
var dy:Number = _ymouse-centerY;
var angle:Number = Math.atan2(-dy, -dx);
var speed:Number = (Math.sqrt(dxdx+dydy))*.05;
var vx:Number = Math.cos(angle)*speed;
var vy:Number = Math.sin(angle)*speed;
if (pichold._x>=(centerX+picrangeX)) {
pichold._x = centerX+picrangeX;
}
if (pichold._x<=(centerX-picrangeX)) {
pichold._x = centerX-picrangeX;
}
if (pichold._y>=(centerY+picrangeY)) {
pichold._y = centerY+picrangeY;
}
if (pichold._y<=(centerY-picrangeY)) {
pichold._y = centerY-picrangeY;
}
pichold._x += vx;
pichold._y += vy;
}

im wondering if i have to take into account the stages width and height at all to get this to work properly. the x and y coors for the picture are all screwed up and i dont know why?!?

im still learning the ropes here…can anyone take a look at this and help me out?

[/LEFT]