# Sliding Image Gallery Positioning

**URL:** <https://forum.kirupa.com/t/sliding-image-gallery-positioning/287691>\
**Category:** flash\
**Created:** [May 5, 2009, 10:11am UTC](https://forum.kirupa.com/t/sliding-image-gallery-positioning/287691 "2009-05-05T10:11:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![iLies](https://avatars.discourse-cdn.com/v4/letter/i/59ef9b/32.png) [@iLies](https://forum.kirupa.com/u/iLies)\
**Post date:** [May 5, 2009, 10:11am UTC](https://forum.kirupa.com/t/sliding-image-gallery-positioning/287691/1 "2009-05-05T10:11:21Z")

</div>

[SIZE=4]Hello everyone![/SIZE]

I found this tutorial an a site where I got [URL=“[http://www.republicofcode.com/tutorials/flash/imagegallery/4.php](http://www.republicofcode.com/tutorials/flash/imagegallery/4.php)”]a code for an image gallery.

What I want is to get the line of Images to always ajust so it is in the middle of the Y-Axis at screen, even if I resize the window. **Does anyone know how to do this?**

I would appreciate any answer thats helpful!

[SIZE=1](I’m no good with actionscript so if you know how to solve my problem please post the “final code”.)[/SIZE]

[SIZE=4]\*\*Thanks!  
\*\*[/SIZE]  
[CENTER][LEFT]

```auto
import mx.transitions.Tween;
import mx.transitions.easing.*;

this.createEmptyMovieClip("container",1);
var imagesNumber:Number = 9;
var scrolling:Boolean = true;

for (i=1; i<=imagesNumber; i++) {
    container.attachMovie("thumb"+i,"thumb"+i+"_mc",i);
    myThumb_mc = container["thumb"+i+"_mc"];
    myThumb_mc._x = (i-1)*myThumb_mc._width;
    myThumb_mc._y = (Stage.height-myThumb_mc._height)/2;
    myThumb_mc._alpha = 50;
    myThumb_mc.largerImage = i;
    myThumb_mc.onRollOver = function() {
        this._alpha = 100;
    };
    myThumb_mc.onRollOut = function() {
        this._alpha = 50;
    };
    myThumb_mc.onRelease = function() {
        this._alpha=50;
        for (i=1; i<=imagesNumber; i++) {
            var myClip = container["thumb"+i+"_mc"];
            myClip.enabled = false;
        }
        scrolling = false;
        _root.attachMovie("image"+this.largerImage,"large_mc",2);
        large_mc._x = (Stage.width-large_mc._width)/2;
        large_mc._y = (Stage.height-large_mc._height)/2;
        new Tween(large_mc, "_alpha", Strong.easeOut, 0, 100, 0.5, true);
        new Tween(container, "_alpha", Strong.easeOut, 100, 50, 0.5, true);
        large_mc.onRelease = function() {
            this.enabled=false;
            scrolling = true;
            var myFadeOut = new Tween(large_mc, "_alpha", Strong.easeOut, 100, 0, 0.5, true);
            new Tween(container, "_alpha", Strong.easeOut, 50, 100, 0.5, true);
            myFadeOut.onMotionFinished = function() {
                for (i=1; i<=imagesNumber; i++) {
                    var myClip = container["thumb"+i+"_mc"];
                    myClip.enabled = true;
                }
                large_mc.removeMovieClip();
            };
        };
    };
}
container.onEnterFrame = function() {
    if (scrolling) {
        this._x += Math.cos((-_root._xmouse/Stage.width)*Math.PI)*15;
        if (this._x>0) {
            this._x = 0;
        }
        if (-this._x>(this._width-Stage.width)) {
            this._x = -(this._width-Stage.width);
        }
    }
};

```

[/LEFT]  
[/CENTER]
