Reputation: 5740
Is it possible to know if a textField inside of a Display Object is dynamic? I'm looping all the children of a Display Object, and I would like to find only Dynamic text fields (I've input tf too, and I want to avoid them) THX
Upvotes: 1
Views: 1142
Reputation: 11294
Use the type property, which will return a string TextFieldType enum value:
//Assuming a DisplayObjectContainer called 'doc':
for (var i:int = 0; i < doc.numChildren; i++)
{
var tf:TextField = doc.getChildAt(i) as TextField;
if (tf != null) // Will be null if the child isn't a TextField
{
switch(tf.type)
{
case TextFieldType.DYNAMIC:
trace("Dynamic");
break;
case TextFieldType.INPUT:
trace("Input");
break;
}
}
}
The documentation is nice and clear:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#type
Upvotes: 3