# For loop and Buttons

**URL:** https://forum.kirupa.com/t/for-loop-and-buttons/179594
**Category:** flash
**Created:** [February 21, 2006, 4:02pm UTC](https://forum.kirupa.com/t/for-loop-and-buttons/179594 "2006-02-21T16:02:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rionbr](https://avatars.discourse-cdn.com/v4/letter/r/9d8465/32.png) [@rionbr](https://forum.kirupa.com/u/rionbr)
#### Post date: [February 21, 2006, 4:02pm UTC](https://forum.kirupa.com/t/for-loop-and-buttons/179594/1 "2006-02-21T16:02:46Z")

</div>

Hello,

So I have this problem for a long time, and have no clue how to solve it.  
I have several buttons on stage (8), and I want to add a slighty different action for everyone of them. How do I do that, All the buttons always get the last past of the “FOR”… HELP ME OUT, I know it’s problably very easy, please…

```auto

function loadThumbs(eventoUrl:String) {
 for(i=1; i<=9; i++) {
  temp = this["thumb_"+i];
  with (temp) {
   image = "fotos/"+eventoUrl+"/thumbs/"+i+".jpg";
   loadImages(image, temp);
   temp.onRollOver = function() {
    this.play();
    };
   temp.onPress = function() {
       this.loadImages(image, image_big);
   };
  };
 };
};

```

loadImages() is a LoadMovieClip type function I created

Anyone? :red:
