# Gallery Thumbnails change random

**URL:** https://forum.kirupa.com/t/gallery-thumbnails-change-random/244158
**Category:** Uncategorized
**Created:** [November 14, 2007, 7:50pm UTC](https://forum.kirupa.com/t/gallery-thumbnails-change-random/244158 "2007-11-14T19:50:43Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sivant](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sivant](https://forum.kirupa.com/u/sivant)
#### Post date: [November 14, 2007, 7:50pm UTC](https://forum.kirupa.com/t/gallery-thumbnails-change-random/244158/1 "2007-11-14T19:50:43Z")

</div>

i have a thumbnail strip made randomly. and i want the thumnails to change in fade also randomly. my problem is that the thumbnail changes before the fade.  
i created a function for each thumbnail like this:

```auto
function pic0() {
 i = random(j);
 this.createEmptyMovieClip("targetClip0", 1);
 targetClip0._x = 22;
 targetClip0._y = 13;
 this.targetClip0.attachMovie("pic"+i, "pic", 1);
}

```

my fadeout function is called from a clip that runs as a timer and goes to a random frame in the timer where i have a function that sends a parameter to the fadeout function that looks like this:

```auto
function fadeOut(param) {
 this.onEnterFrame = function() {
  if (_root["targetClip"+param]._alpha>0) {
   _root["targetClip"+param]._alpha -= 10;
  }
 };
 _root["picB"+param]();
}

```

the \*\*\_root"picB"+param;\*\*is suppose to create the thumbnail that is suppose to exchange the first one.  
which looks like this:

```auto
function picB0() {
 
 i = random(j);
 this.createEmptyMovieClip("targetClipB0", 6);
 targetClipB0._x = 32;
 targetClipB0._y = 23;
 this.targetClipB0.attachMovie("pic"+i, "pic", 6);
 fadeIn(0);
 }

```

my fadeIn function looks like this:

```auto
unction fadeIn(param) {
 
 this.onEnterFrame = function() {
  if (_root["targetClipB"+param]._alpha<100) {
   _root["targetClipB"+param]._alpha += 5;
  }
 };
_root["pic"+param]();
}

```

what this does is show me the targetClipB all the time and i know this is a long question but maybe some one can help me?
