attaching id to a movieclip
Posted
by Ross
on Stack Overflow
See other posts from Stack Overflow
or by Ross
Published on 2010-04-21T15:21:28Z
Indexed on
2010/04/21
15:23 UTC
Read the original article
Hit count: 285
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.
© Stack Overflow or respective owner