createTextField()

hi.

i’m looking for the most efficient way to program this:


for (var i:Number=0; i <= 7; i++){
// create 7 text fields
			
// place them in 7 equal columns across the stage

i thought i might need these variables to do it:


var stageWidth:Number = _width;
var numCols:Number = 7;
var indivColWidth = stageWidth/7;

but i am unsure how to go about writing this best.

any suggestions?

thanks. fumeng.

var stageWidth = Stage.width;
var numCols = 7;
var indivColWidth = stageWidth/numCols;
var indivColHeight = 100;
for (var i = 0; i<numCols; ++i) {
	createTextField("t"+i, 100+i, i*indivColWidth, 0, indivColWidth, indivColHeight);
	this["t"+i].border = true;
	this["t"+i].text = "Textfield "+i;
}

very nice. thank you very much.

welcome.