I am trying to create a styled mc dynamically which works great that I will then duplicate and populate with xml data. Issue is I am able to create the container clip with script but when I try to duplicate it in a for statement nothing appears on the stage not even the first rectangle named container.
Here is the code
/////////////////////////////
// -- Rectangle Function
/////////////////////////////
function drawRectangle(mcClip:MovieClip, nWidth:Number, nHeight:Number):Void {
mcClip.lineTo(nWidth, 0);
mcClip.lineTo(nWidth, nHeight);
mcClip.lineTo(0, nHeight);
mcClip.lineTo(0, 0);
}
/////////////////////////////
// -- Draw Rectangle
/////////////////////////////
var container:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
_root.container.lineStyle(1, 0x000000, 0);
_root.container.beginFill(0x332211, 50);
drawRectangle(container, 60, 60);
_root.container.endFill();
/////////////////////////////
// -- Variables
/////////////////////////////
var xPos = 60;
var yPos = 60;
/////////////////////////////
// -- Create Thumb
/////////////////////////////
for (i=0; i<10; i++) {
_root.container.duplicateMovieClip("new"+i, i, {_x:xPos, _y:yPos});
xPos += _root["new"+i]._width+5;
if (xPos>400) {
xPos = 60;
yPos += 60;
}
}