attaching id to a movieclip
- by Ross
I have a loop that creates mc from a database
for (var i:Number = 0; i < t.length; i++) {
var portfolioItem:PortfolioItem = new PortfolioItem();
addChild(portfolioItem);
portfolioItem.name = t[i][0];
portfolioItem.addEventListener(MouseEvent.CLICK, getThisName);
}
public function getThisName(evt:Event) {
trace(evt.target.name);
}
I try and assign t[i][0] which is the table id to the name attribute but I jsut get 'instance4' or instance 14. 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.