Photo Gallery Help

I have a photo gallery for a client where you can zoom in and scroll around on a photo. I can’t seem to get the scrolling to stop when the image edge hits the mask edge. I thought I had it but everything I try sooms to not work. Can anyone give me a little help.

Thx

SR:smirk:

www.worldslargestforum.com/upward/OlympusFlashtestzoomfix.fla

The quick fix would be to move the picture back to the centre:

import mx.transitions.Tween;
import mx.transitions.easing.*;
var speed:Number = 50;
var zoomLevels:Array = new Array();
zoomLevels[0] = gallery._xscale;
zoomLevels[1] = zoomLevels[0] * 1.5;
zoomLevels[2] = zoomLevels[1] * 1.5;
zoomLevels[3] = zoomLevels[2] * 1.5;
var zoom:Number = 0;
nav._visible = false;
var startx:Number = gallery._x;
var starty:Number = gallery._y;
var xMove:Tween = new Tween(gallery, "_x", Regular.easeOut, gallery._x, gallery._x, 1, true);
var yMove:Tween = new Tween(gallery, "_y", Regular.easeOut, gallery._y, gallery._y, 1, true);
var xScale:Tween = new Tween(gallery, "_xscale", Regular.easeOut, gallery._xscale, gallery._xscale, 1, true);
var yScale:Tween = new Tween(gallery, "_yscale", Regular.easeOut, gallery._yscale, gallery._yscale, 1, true);
var alpha:Tween = new Tween(nav, "_alpha", Regular.easeOut, 0, 0, 1, true);
nav.arrowDown.onPress = function():Void  {
 if (zoom > 0) {
  onEnterFrame = function () {
   if (gallery._y + gallery._height / 2 > galleryMask._y + galleryMask._height + speed) {
    yMove.continueTo(gallery._y - speed, .5);
   } else {
    yMove.continueTo(galleryMask._y + galleryMask._height - gallery._height / 2, .5);
   }
  };
 }
};
nav.arrowDown.onRelease = nav.arrowDown.onReleaseOutside = function ():Void {
 delete onEnterFrame;
};
nav.arrowLeft.onPress = function():Void  {
 if (zoom > 0) {
  onEnterFrame = function () {
   if (gallery._x - gallery._width / 2 < galleryMask._x - speed) {
    xMove.continueTo(gallery._x + speed, .5);
   } else {
    xMove.continueTo(galleryMask._x + gallery._width / 2, .5);
   }
  };
 }
};
nav.arrowLeft.onRelease = nav.arrowLeft.onReleaseOutside = function ():Void {
 delete onEnterFrame;
};
nav.arrowRight.onPress = function():Void  {
 if (zoom > 0) {
  onEnterFrame = function () {
   if (gallery._x + gallery._width / 2 > galleryMask._x + galleryMask._width + speed) {
    xMove.continueTo(gallery._x - speed, .5);
   } else {
    xMove.continueTo(galleryMask._x + galleryMask._width - gallery._width / 2, .5);
   }
  };
 }
};
nav.arrowRight.onRelease = nav.arrowRight.onReleaseOutside = function ():Void {
 delete onEnterFrame;
};
nav.arrowUp.onPress = function():Void  {
 if (zoom > 0) {
  onEnterFrame = function () {
   if (gallery._y - gallery._height / 2 < galleryMask._y - speed) {
    yMove.continueTo(gallery._y + speed, .5);
   } else {
    yMove.continueTo(galleryMask._y + gallery._height / 2, .5);
   }
  };
 }
};
nav.arrowUp.onRelease = nav.arrowUp.onReleaseOutside = function ():Void {
 delete onEnterFrame;
};
zoomIn.onRelease = function():Void  {
 if (zoom < 3) {
  if (zoom == 0) {
   nav._visible = true;
   alpha.continueTo(100, .5);
  }
  zoom++;
  xScale.continueTo(zoomLevels[zoom], .5);
  yScale.continueTo(zoomLevels[zoom], .5);
 }
};
zoomOut.onRelease = function():Void  {
 if (zoom > 0) {
  if (zoom == 1) {
   alpha.continueTo(0, .5);
   alpha.onMotionFinished = function():Void  {
    nav._visible = false;
    delete this.onMotionFinished;
   };
  }
  zoom--;
  xMove.continueTo(startx, .5);
  yMove.continueTo(starty, .5);
  xScale.continueTo(zoomLevels[zoom], .5);
  yScale.continueTo(zoomLevels[zoom], .5);
 }
};

:thumb:

Thanks again bro:P