# Photo Gallery Help

**URL:** <https://forum.kirupa.com/t/photo-gallery-help/181887>\
**Category:** Uncategorized\
**Created:** [March 14, 2006, 12:38am UTC](https://forum.kirupa.com/t/photo-gallery-help/181887 "2006-03-14T00:38:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SlowRoasted](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@SlowRoasted](https://forum.kirupa.com/u/SlowRoasted)\
**Post date:** [March 14, 2006, 12:38am UTC](https://forum.kirupa.com/t/photo-gallery-help/181887/1 "2006-03-14T00:38:29Z")

</div>

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](http://www.worldslargestforum.com/upward/OlympusFlashtestzoomfix.fla)

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [March 21, 2006, 4:44am UTC](https://forum.kirupa.com/t/photo-gallery-help/181887/2 "2006-03-21T04:44:28Z")

</div>

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

```auto
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:

---

<div class="post-metadata">

**Author:** ![SlowRoasted](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@SlowRoasted](https://forum.kirupa.com/u/SlowRoasted)\
**Post date:** [March 21, 2006, 4:54pm UTC](https://forum.kirupa.com/t/photo-gallery-help/181887/3 "2006-03-21T16:54:01Z")

</div>

Thanks again bro:P
