# Help me to create loop of this array result

**URL:** <https://forum.kirupa.com/t/help-me-to-create-loop-of-this-array-result/255826>\
**Category:** programming\
**Created:** [March 27, 2008, 12:11pm UTC](https://forum.kirupa.com/t/help-me-to-create-loop-of-this-array-result/255826 "2008-03-27T12:11:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beebs](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Beebs](https://forum.kirupa.com/u/Beebs)\
**Post date:** [March 27, 2008, 12:11pm UTC](https://forum.kirupa.com/t/help-me-to-create-loop-of-this-array-result/255826/1 "2008-03-27T12:11:25Z")

</div>

I try to load array result generated from php.

The PHP result are as follows :

```auto
Title0=1&Comments0=HOME&Title1=6&Comments1=ABOUT&Title2=2&Comments2=SOLUTIONS&menu=3

```

I use this following code in Flash and work successfully :

```auto

myData = new LoadVars();
myData.load("http://localhost/mytry.php");

myData.onLoad = function(success) {
	if (success){
		trace ("success");
		_root.testing.displayText.text = this["Comments"+2]
		
		}
	
}

```

Now, as you know from the result above, I need to create loop in order to show the entire result. I use this code and does not work :

```auto

myData = new LoadVars();
myData.load("http://localhost/mytry.php");

myData.onLoad = function(success) {
	if (success){
		for (var i=0;i<menu.length;i++)
	{
		var k = _root.navigation.attachMovie("placeholder", "placeholder"+i, i);
		k._alpha = 0;
		k.displayText.text = menu["Comments"+i];
		k._x = Math.round(2 + ((k._width+12)*i));
		k._y = 0;
		}
		trace ("success");
		}
}

```

Obviously the date are successfully loaded, but can someone point me out why the code does not work?

Thanks a lot
