Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 138
Registered: ‎01-09-2011
My Device: Blackberry Tablet OS

List All TextFields on stage.

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)?

 

Thanks,

Noah NU

From,
Noah NU
Developer
Posts: 1,269
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: List All TextFields on stage.

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.

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: List All TextFields on stage.

hey,

 

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 Smiley Happy

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 138
Registered: ‎01-09-2011
My Device: Blackberry Tablet OS

Re: List All TextFields on stage.

I am going to go with UberschallSamsara's method since I am using multiple TextFormats for size,bold,italics etc...

From,
Noah NU