I am having issues creating several dynamic text boxes inside a movieclip using a for loop. I am using AS 2. Here is the code I have created thus far
var leading:Number = 0;
function drawClip():Void
{
this.createEmptyMovieClip("mc", 10);
for(i=0;i<5;i++)
{
mc.createTextField("textBoxes" + i, this.getNextHighestDepth(), 0, leading, 200, 200)
mc["textBoxes" + i].text = i;
leading += 20;
}
}
drawClip();
It does create a mc but only display the number 5
Any thoughts?
You are cionstantly overwriting the previously created textfield due to using the wrong depth definer. You are pointing to "this" to get a depth value, but planting it inside "mc", so it is always going to the same depth since "this" 's depth index doesn't change. Use...
mc.createTextField("textBoxes" + i, mc.getNextHighestDepth(), 0, leading, 200, 200)
North America
Europe, Middle East and Africa
Asia Pacific