# How scrollbar gallery images stable on 1st loading of swf

**URL:** <https://forum.kirupa.com/t/how-scrollbar-gallery-images-stable-on-1st-loading-of-swf/331693>\
**Category:** Uncategorized\
**Created:** [September 27, 2013, 4:01pm UTC](https://forum.kirupa.com/t/how-scrollbar-gallery-images-stable-on-1st-loading-of-swf/331693 "2013-09-27T16:01:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bracelett](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@bracelett](https://forum.kirupa.com/u/bracelett)\
**Post date:** [September 27, 2013, 4:01pm UTC](https://forum.kirupa.com/t/how-scrollbar-gallery-images-stable-on-1st-loading-of-swf/331693/1 "2013-09-27T16:01:44Z")

</div>

I have this scroll thumbs, a simple image gallery with 125 X 125 pixels size each thumbs,with right and lef arrow buttons symbol,  
it loads 4 images every scroll and it works fine, the only problem I is when it 1st load of swf the scroll movieclip push to left which lead to  
2nd set of the whole thumb, all i want is just stay in the 1st set which is the 1st 4 images when you load the swf.

here is my AS2 script, which in this part i have to adjust? any help will be appreciated!

```auto
var totalThumbs:Number = 10;
var thumbsPerPage:Number = 5;
var thumbWidth:Number = 125; // pixels
var thumbPad:Number = 6; // pixels
var activePage:Number = 1;
var totalPages:Number = Math.floor(totalThumbs / thumbsPerPage);

var thumbHolder:MovieClip = this.thumbs; // holder mc
var controller:MovieClip = this.createEmptyMovieClip("controller", this.getNextHighestDepth());

var startX:Number = thumbHolder._x;

controller.onEnterFrame = function()
{
	thumbHolder._x += (startX - activePage * (thumbWidth + thumbPad) * thumbsPerPage - thumbHolder._x) / 3;
	btnPrev._visible = (activePage != 0);
	btnNext._visible = (activePage != totalPages);
}

btnNext.onRelease = function()
{
	if(activePage < totalPages) activePage++;
}

btnPrev.onRelease = function()
{
	if(activePage > 0) activePage--;
}

```
