# For loop syntax question

**URL:** <https://forum.kirupa.com/t/for-loop-syntax-question/257737>\
**Category:** Uncategorized\
**Created:** [April 16, 2008, 6:26pm UTC](https://forum.kirupa.com/t/for-loop-syntax-question/257737 "2008-04-16T18:26:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![oldgreymare](https://avatars.discourse-cdn.com/v4/letter/o/838e76/32.png) [@oldgreymare](https://forum.kirupa.com/u/oldgreymare)\
**Post date:** [April 16, 2008, 6:26pm UTC](https://forum.kirupa.com/t/for-loop-syntax-question/257737/1 "2008-04-16T18:26:05Z")

</div>

Hi there everyone.  
I have a silly question. I’ve seen examples of the for loop written for(i in this) but it never seems to work for me. The code below works if I use numbers but not the ‘this’ (whether I have the var in or not). Am I just writing it incorrectly? Thanks a bunch for looking!

```auto

for(var i in this){
	_root["m"+i].onRelease = function(){
		selectVid=this._name+".flv";
		video1.attachVideo(netVid); 
		netVid.setBufferTime(2); 
		netVid.play(selectVid); 
		_root.info_txt.htmlText = loadText[this._name];
		}
}

```

```auto

for(i=0;i<7;i++){
	_root["m"+i].onRelease = function(){
		selectVid=this._name+".flv";
		video1.attachVideo(netVid); 
		netVid.setBufferTime(2); 
		netVid.play(selectVid); 
		_root.info_txt.htmlText = loadText[this._name];
		}
}

```
