Creating multiple text fields

I’m drawing a graph in flash, and I need to draw a scale.

Inside a newly created movie clip (using createEmptyMovieClip):


for(i=0; i<=sizeY; i+=yScale) {
	createTextField("mytext"+i,2,0,i,30,15);
	["mytext"+i].border = true;
	myformat = new TextFormat();
	myformat.color = 0xff0000;
	myformat.underline = true;
	["mytext"+i].text=i;
	["mytext"+i].setTextFormat(myformat);
}

The problem seems to lie with [“mytext”+i]… I got that convention from an example on this website, except that it was something like _root [“mytext”+i]. But I do not wish for the text field to be in _root… it has to be in the current movie clip.

Any ideas?

You can specify the entite path if you have it in the current mc like

_root.mc[“mytext”+i].text = i;

Try this! Hope this helps!

Oh wow, didn’t think of that :slight_smile: Thanks!

Usually using the absolute path helps a lot when you are working with a lot of variables. You can easily keep track of things.