I am trying to create multiple textfields during runtime using the createTextField method in my actions layer.
I've tried to create them all in a loop in one movieclip, but that was only displaying one textfield, so I figured it was a problem with the movieclip... so now I'm trying to create a movieclip for each textfield without overwriting any of my other movieclips...
Here's my code for the textfields and movieclips:
var pixelsx:Number=_root.cyclo._x+20;
var pixelsy:Number=_root.cyclo._y + 20;
var boxNumber: Number=1;
var depth:String;
var layer:MovieClip;
var my_fmt:TextFormat= new TextFormat();
my_fmt.color= 0xFFFFFF
do{
depth=this.getNextHighestDepth();
layer.createEmptyMovieClip(("magnetic"+depth), Number(depth));
layer["magnetic"+depth].createTextField(("label" + boxNumber), magnetic.getDepth(),pixelsx,pixelsy,30,30);
pixelsx=pixelsx+30;
layer["magnetic"+depth}["label"+boxNumber].setTextFormat(my_fmt);
layer["magnetic"+depth]["label"+boxNumber].text="X";
boxNumber++;
}while(pixelsx<(_root.cyclo._x+_root.cyclo._width));
I'm wondering what I'm doing wrong or if there is a better/easier way to create textfields with unique names at runtime.
Thanks
I've tried to create them all in a loop in one movieclip, but that was only displaying one textfield, so I figured it was a problem with the movieclip... so now I'm trying to create a movieclip for each textfield without overwriting any of my other movieclips...
Here's my code for the textfields and movieclips:
var pixelsx:Number=_root.cyclo._x+20;
var pixelsy:Number=_root.cyclo._y + 20;
var boxNumber: Number=1;
var depth:String;
var layer:MovieClip;
var my_fmt:TextFormat= new TextFormat();
my_fmt.color= 0xFFFFFF
do{
depth=this.getNextHighestDepth();
layer.createEmptyMovieClip(("magnetic"+depth), Number(depth));
layer["magnetic"+depth].createTextField(("label" + boxNumber), magnetic.getDepth(),pixelsx,pixelsy,30,30);
pixelsx=pixelsx+30;
layer["magnetic"+depth}["label"+boxNumber].setTextFormat(my_fmt);
layer["magnetic"+depth]["label"+boxNumber].text="X";
boxNumber++;
}while(pixelsx<(_root.cyclo._x+_root.cyclo._width));
I'm wondering what I'm doing wrong or if there is a better/easier way to create textfields with unique names at runtime.
Thanks