TextField is not a Flex component and cannot be added to a container. There are rules regarding what can be added to what if you search the archives.
Use TextInput. Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of timgerr Sent: Tuesday, July 15, 2008 12:31 PM To: [email protected] Subject: [flexcoders] Add ActionScript created items to flex I think this is an easy one but I cannot figure it out. I want to dynamically crate a text imput box via ActionScript and I get errors when I do the addChild. Here is my code: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " layout="absolute"> <mx:Script> <![CDATA[ import flash.text.*; import flash.display.DisplayObjectContainer; import flash.display.Sprite; public function WriteMe():void { var field:TextField = new TextField(); field.type = TextFieldType.INPUT; field.border = true; field.background = true; addChild(field); } ]]> </mx:Script> <mx:Button id="btn" label="press me" click="WriteMe()"/> </mx:Application> I am getting a debug error with the addChild(field); What am I doing wrong??? Thanks for the read and help, timgerr

