# Go to First thumbnail image

**URL:** https://forum.kirupa.com/t/go-to-first-thumbnail-image/231467
**Category:** flash
**Created:** [July 5, 2007, 3:12am UTC](https://forum.kirupa.com/t/go-to-first-thumbnail-image/231467 "2007-07-05T03:12:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![gooddesi](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@gooddesi](https://forum.kirupa.com/u/gooddesi)
#### Post date: [July 5, 2007, 3:12am UTC](https://forum.kirupa.com/t/go-to-first-thumbnail-image/231467/1 "2007-07-05T03:12:20Z")

</div>

I have created a thumbnail in my photo gallery and all are working fine. thumbnails are on left side (Up-Down).  
when i change category, by default thumbnail do not go to the first image.

Following is the scenario:

“Category1” button have 25 images  
“Category2” button have 10 images.

Now i am on 15th image in “Category1” at that point, when i click on “Category2” command button, thumbnail loaded for “Category2” shows last few image of thumbnail. To see the first image of “Category2” i have to scroll up.

Can you please let me know what changes i have to made in this code; so it show the first thumbnail when i change category?

Following is the thumbnail code i am using.

function thumbnails\_fn (k)  
{  
thumbnail\_mc.createEmptyMovieClip (“t” + k, thumbnail\_mc.getNextHighestDepth ());  
tlistener = new Object ();  
tlistener.onLoadInit = function (target\_mc)  
{  
target\_mc.\_y = hit\_left.\_y + (eval (“thumbnail\_mc.t” + k).\_height + 5) \* k;  
target\_mc.pictureValue = k;  
target\_mc.onRelease = function ()  
{  
p = this.pictureValue;  
// Draw Picture  
setPicture §;  
};  
target\_mc.onRollOver = function ()  
{  
this.\_alpha = 50;  
thumbNailScroller ();  
};  
target\_mc.onRollOut = function ()  
{  
this.\_alpha = 100;  
};

```
};
image_mcl = new MovieClipLoader ();
image_mcl.addListener (tlistener);
image_mcl.loadClip (thumbnails[k], "thumbnail_mc.t" + k);

```

}

function thumbNailScroller ()  
{  
this.createEmptyMovieClip (“tscroller”, 1000);  
scroll\_speed = 10;  
tscroller.onEnterFrame = function ()  
{  
if ((\_root.\_xmouse \>= thumbnail\_mc.\_x) && (\_root.\_xmouse \<= thumbnail\_mc.\_x + thumbnail\_mc.\_width))  
{  
if ((\_root.\_ymouse \>= (hit\_right.\_y - 40)) && (thumbnail\_mc.hitTest (hit\_right)))  
{  
thumbnail\_mc.\_y -= scroll\_speed;  
}  
else if ((\_root.\_ymouse \<= 100) && (thumbnail\_mc.hitTest (hit\_left)))  
{  
thumbnail\_mc.\_y += scroll\_speed;  
}  
}  
else  
{  
delete tscroller.onEnterFrame;  
}  
};  
}

Category1.onRelease = function ()  
{  
category\_fn (“Category1”);

```
};

```

function category\_fn (category)  
{  
if (\_root.levelChild.childNodes[attr].attributes.Menu == category)  
{  
var loader:MovieClipLoader = new MovieClipLoader ();  
var myListener:Object = new Object ();  
loader.addListener (myListener);  
loader.loadClip (info\_xml[0].attributes.thumbnail, thumbnail\_mc);  
myListener.onLoadInit = function (target\_mc)  
{  
setPicture (0);  
for (i = 0; i \< itemTotal; i++)  
{  
thumbnails\* = info\_xml\*.attributes.thumbnail;  
thumbnails\_fn (i);  
}  
};  
}  
}  
 ![](http://forum.kirupa.com/uploads/kirupa/615/b7e0d890f190c4d7.gif)[![](http://www.actionscript.org/forums/images/buttons/report.gif) ![](http://www.actionscript.org/forums/images/misc/progress.gif) [URL=“http://www.actionscript.org/forums/editpost.php3?do=editpost&p=627406”] ![](http://www.actionscript.org/forums/images/buttons/edit.gif)](http://www.actionscript.org/forums/report.php3?p=627406)
