# For loop in button action not properly working

**URL:** https://forum.kirupa.com/t/for-loop-in-button-action-not-properly-working/205822
**Category:** Uncategorized
**Created:** [November 2, 2006, 9:23am UTC](https://forum.kirupa.com/t/for-loop-in-button-action-not-properly-working/205822 "2006-11-02T09:23:14Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![olki](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/olki/32/157_2.png) [@olki](https://forum.kirupa.com/u/olki)
#### Post date: [November 2, 2006, 9:23am UTC](https://forum.kirupa.com/t/for-loop-in-button-action-not-properly-working/205822/1 "2006-11-02T09:23:14Z")

</div>

Hi I’m creating a game for my son where he is supposed to build a word from a bunch of letters.

On each of the letters I’ve attached the following code:

```php

on (press) {
  startDrag(this, false, _root.left+40, _root.top+40, _root.right-40, _root.bottom-40);
  this._xscale = 110;
  this._yscale = 110;
}
on (release, releaseoutside) {
  stopDrag();
  for(var i = 0; i <= _root.theWord.length-1; i++){
    //Convert droptarget from /-path to .-path
    if (eval(this._droptarget) == _root.main_mc["targetBox"+i]) {
      this._xscale = 70; //This action is no executed
      this._yscale = 70; //This action is no executed
      this._x = _root.main_mc["targetBox"+i]._x; //This is executed
      this._y = _root.main_mc["targetBox"+i]._y; //This is executed
    } else {
      this._xscale = 100;
      this._yscale = 100;
    }
  }
}

```

Now I have this problem that the “xscale” and “yscale” action is only performed when released on the last target clip in the for loop. But the line “this.\_x” and this.\_y is performed everytime I release a letter on a valid place.  
Does anyone know why?

Cheers, Ola
