# \[AS3\] - For(loop) Object creation help

**URL:** <https://forum.kirupa.com/t/as3-for-loop-object-creation-help/268839>\
**Category:** Uncategorized\
**Created:** [August 19, 2008, 4:17pm UTC](https://forum.kirupa.com/t/as3-for-loop-object-creation-help/268839 "2008-08-19T16:17:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![switchBack](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@switchBack](https://forum.kirupa.com/u/switchBack)\
**Post date:** [August 19, 2008, 4:17pm UTC](https://forum.kirupa.com/t/as3-for-loop-object-creation-help/268839/1 "2008-08-19T16:17:09Z")

</div>

Hey every one. I have been in the transition from AS2 to AS3 and have run into a little snag that I need help with for a project I’m working on. Without too much detail, all I want to do is create a pretty simple navigation.

In AS2 all I would do is something similar to:

```auto

var menu_obj:Object = new Object();
menu_obj.drop = new Array();

_root.createEmptyMovieClip("menu_mc", this.getNextHighestDepth());
for(var i:Number = 0; i < menuLen; i++){     
     menu_obj.drop* = menu_mc.createEmptyMovieClip("option_mc"+i, i);   
        
     menu_obj.drop*.link_url = curMenu*.attributes.url;
     menu_obj.drop*.onRelease = menu_obj.drop*.onReleaseOutside = function(){
         getURL(this.link_url);
     };
 };

```

So basically I’m trying to convert that into AS3, so that I create the navigation and am able to assign it attributes to use in an Event Handler. But I’m running into problems. If anyone could please help I would really appreciate it.

I’m not understanding how to create unique objects/sprites using \* like I would before to be able to control each navigation element in a for loop.

I came up with something like this, but then got stuck:

```auto

var nav_obj:Object = new Object();
for(var i:uint; i < 4; i++){
     nav_obj* = new Sprite();
     nav_obj*. **property** = i; //I'm unable to figure out how to do this...

     nav_obj*.graphics.beginFill();
     ...
     nav_obj*.graphics.endFill();

     nav_obj*.addEventListener(MouseEvent.CLICK, onButtonClick);

};

function onButtonClick(event:MouseEvent):void{
     trace(event.target **.property** );
};

```

Thank you, so much, for your help.
