# onEnterFrame looping problem

**URL:** <https://forum.kirupa.com/t/onenterframe-looping-problem/332195>\
**Category:** flash\
**Created:** [February 26, 2014, 10:53pm UTC](https://forum.kirupa.com/t/onenterframe-looping-problem/332195 "2014-02-26T22:53:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![theicecube92](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@theicecube92](https://forum.kirupa.com/u/theicecube92)\
**Post date:** [February 26, 2014, 10:53pm UTC](https://forum.kirupa.com/t/onenterframe-looping-problem/332195/1 "2014-02-26T22:53:16Z")

</div>

Hey guys,  
So I have this code below.

```auto
function myfunction():Void {
	for (i = 0; i < 100; i++) {
		_root.attachMovie('platform','platform_' + i,i,{_x:275 + i * 100, _y:200});
	}
}
myfunction();
_root['platform_' + i].onEnterFrame = function():Void {
	_x -= 5;
};

```

The code generates 5 platforms movieclips and is also placing them on 275x and 200y. There is a space of 100 pixels between each of them. I want to give all of these platforms an action to do, like \_x -= 5; but it  
simply doesn’t work with what I’ve written.

Could anyone tell me what I’m doing wrong?

Thanks!
