PDA

View Full Version : Changing TextField texts dynamically


archon
01-22-2009, 10:41 PM
I'm trying to write code that will set the text property of a TextField whose name includes a variable. In other words, something like this:
setProperty("field"+i,text,"new text");
Except I can't use that, because Flash doesn't recognize 'text' as a variable to set. How else can I do this?

atomic
01-23-2009, 03:51 AM
Assuming your textfield is on the main timeline...

_level0["field"+i].text = "new text";

archon
01-27-2009, 12:35 AM
Thanks! I finally had time away from school to try that solution, and it did indeed work on the main timeline. The TextFields in question are part of a movie clip, however, and much as I've tried I can't seem to adapt _levelN to work under those circumstances. Does anyone know either that or a different workaround?

atomic
01-27-2009, 01:16 AM
_level0.clip_instance_name["field"+i].text = "new text";

archon
01-28-2009, 01:58 AM
Thanks a lot! That does exactly what I need it to.

atomic
01-28-2009, 02:02 AM
Grrrrrrrreat! ;)