01-19-2011 11:12 PM
How do I get a list of ALL the text fields in my application on the visible stage? Basically I want to be able to change the font family of all visible text in my application with a single click of a button. To do this I need to loop through the DisplayObjects. How do I get all the Display objects (from this I can filter out the Text Fields)?
01-20-2011 12:01 AM
You can grab the numChildren property of a display object, use it as a loop terminal count, and grab references to all the display object's children with a loop that calls getChildAt() on each child's index. If the reference returned by getChildAt() is a display object container, you can recurse down into it. You can use the "is" keyword to test the type of each object, to test if an object is a display object container, and to filter for text fields.
01-20-2011 01:23 AM
what UberschallSamsara said is correct but i thought id add something. instead of going through all the textfield objects, why not manipulate the TextFormat object and apply it to your textfields? unless there is a reason why thats not possible based on what you are doing in your code. if thats the case ignore my post