Set interval

Hi there,

I have an image gallery, which passes in three images ata time, and i have a load of gallery buttons which load pictures.

First of all, i work out how many gallewry buttons i need, by dividing the number if images by three, easy peasy.

Then what i need to do, is to loop through the gallery buttons from 0 to number of buttonsneeded, and fade each button in. i could tween this, but i wold like to script it. Simply using the code below, the loops are too fast, and the gallery buttons simply appear immediately

 
// i have just loaded in the images, and stored the number in this load vars object, kitchentext
 
this._parent.kitchentext.onLoad = function() {
  //hide all
  for (z=0; z<=6; z++) {
   _root["gallery"+z]._visible = false;
  }
  //get total number of images
  this.image_number = _root.kitchentext[_root.Currentkitchen+"_number"];
  this.gallerybuttons = this.image_number/3;
  //show gallery buttons needed
  for (i=0; i<=this.gallerybuttons; i++) {
   _root["gallery"+i]._alpha = 0;
   _root["gallery"+i]._visible = true;
   for (p=0; p<=100; p++) {
	_root["gallery"+i]._alpha += 1;
   }
  }
 };
 

So, i found the set interval fucntion, and came up with this

 
 
this._parent.kitchentext.onLoad = function() {
  //hide all
  for (z=0; z<=6; z++) {
   _root["gallery"+z]._visible = false;
  }
  //get total number of images
  this.image_number = _root.kitchentext[_root.Currentkitchen+"_number"];
  this.gallerybuttons = this.image_number/3;
  for (i=0; i<=this.gallerybuttons; i++) {
   //set gallery properties
   _root["gallery"+i]._alpha = 0;
   _root["gallery"+i]._visible = true;
   //create the function which increments gallery item alpha by 1
   increaseAlpha = function () {
	_root["gallery"+i]._alpha += 1;
	// if the galleries alpha = 100, break interval
	if (_root["gallery"+i]._alpha=100) {
	 clearInterval(Go);
	}
   };
   Go = setInterval(increaseAlpha, 10);
   //create interval to call fucntion every 10 milliseconds
  }
 };
 
 

This on in an on press event. (whether that makes any difference i dont know), and i cant seem to get it to work

Really greatful for any help on this, not long been using as :slight_smile:

many thanks

jamie