Variables in Functions Quick Question

Hey all,

I can’t figure this out.


function createTextBoxes() {
	for (var  n=0;  n<caption_obj.textXML.length;  n++){
		this.createTextField("captions"+n, n, 280, 288, 470, 87);
		this["captions"+n]._x = 200;
		this["captions"+n]._y = 200;
		this["captions"+n].text = caption_obj.currCaption[n];
	}
};

The XML portion is working fine. What I’d like to be able to do is access the created text fields outside of the function. For example:

captions1.alphaTo(0,1,“linear”,1);

This works fine when it’s inside of the function, but outside of it, it won’t. Basically I need to time the captions to things that are happening in an animation. The animations are also tween driven, so it would be something like obj_mc.tween("_x", 200,2,“linear”,5,fadeOutCaption1); with fadeOutCaption1 being a function that fades out the first caption and brings in the second. If there is a better/more effecient way of doing this let me know.

I also can’t seem to apply any styles to the text field. Do I need to create an array or object with [“captions”+n] and then pull from that?

Thanks!