# Dynamic mc's and properties

**URL:** <https://forum.kirupa.com/t/dynamic-mcs-and-properties/308361>\
**Category:** Uncategorized\
**Created:** [April 21, 2010, 3:26pm UTC](https://forum.kirupa.com/t/dynamic-mcs-and-properties/308361 "2010-04-21T15:26:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RossKidd](https://avatars.discourse-cdn.com/v4/letter/r/53a042/32.png) [@RossKidd](https://forum.kirupa.com/u/RossKidd)\
**Post date:** [April 21, 2010, 3:26pm UTC](https://forum.kirupa.com/t/dynamic-mcs-and-properties/308361/1 "2010-04-21T15:26:50Z")

</div>

have a loop that creates a load of mc’s, and populates with data from a mysql database

```auto
for (var i:Number = 0; i < t.length; i++) {

var portfolioItem:PortfolioItem = new PortfolioItem();
addChild(portfolioItem);
portfolioItem.name = t*[0];
portfolioItem.addEventListener(MouseEvent.CLICK, getThisName);

}
public function getThisName(evt:Event) {
trace(evt.target.name);
}

```

I try and assign t\*[0] which is the row id to the name attribute but I jsut get ‘instance4’ or instance 14 when I try to trace it out.

How can I give these dynamically create mc’s a name or custom property?  
ideally I would like to use a custom property called portfolio.id but would use the name property or another default property if it works.
