# \[FMX\] scope of variables in loop?

**URL:** <https://forum.kirupa.com/t/fmx-scope-of-variables-in-loop/144103>\
**Category:** Uncategorized\
**Created:** [April 11, 2005, 8:11pm UTC](https://forum.kirupa.com/t/fmx-scope-of-variables-in-loop/144103 "2005-04-11T20:11:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![binlid](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/binlid/32/1242_2.png) [@binlid](https://forum.kirupa.com/u/binlid)\
**Post date:** [April 11, 2005, 8:11pm UTC](https://forum.kirupa.com/t/fmx-scope-of-variables-in-loop/144103/1 "2005-04-11T20:11:20Z")

</div>

```auto
var x:Number = 0;
var y:Number = 0;
var i:Number = 1;

while(y < 400)
{
  while(x < 600)
  {
	this.attachMovie("hover_mc", "sq_", this.getNextHighestDepth(), {_x:x, _y:y});
	x += 50;
	i++;
  }
  y += 50;
}

```

i have no access to **y** in the (x \< 600) loop… yet **i** gets incremented every loop… i am baffled! can anybody shed any light on this?
