Access the protected TextField in TextInput control for Flex

Posted in Flash, Flex on July 26th, 2009 by eccheung4

The other day, I was struggling trying to get access to the textfield of a TextInput Control, which was protected. I needed it because I was loading an AS3 swf into a flex project and it needed to be passed a reference to a textfield to interact with it, but in flex it was a textinput control which contains a textfield. You can’t ues textInput.getTextField() because its protected.

To make it work you simply add:

import mx.core.mx_internal;
use namespace mx_internal;

I found out about it in this forum thread
http://www.actionscript.org/forums/showthread.php3?t=173666

Tags: , , ,