In 2.0, you use addChild(). Here is a full example: http://www.cflex.net/showFileDetails.cfm?ObjectID=562
Tracy ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alex Birch Sent: Wednesday, October 03, 2007 12:44 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Dynamic TextInput Creation Would you please point me to a tutorial on how to dynamically create new textinput forms, for flex 2. I've found many with the createChild() method that don't work in flex 2.0. After 5 characters are added into SomeNumber-TextInput, I would like to create a new TextInput with the next number So at the end I would have objects like: I would like to do something like this: var someNumber1:TextInput; var someNumber2:TextInput; var someNumber3:TextInput; Any thoughts would be appreciated. <?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 mx.containers.Panel; import mx.utils.StringUtil; import mx.formatters.DateFormatter; import mx.formatters.DateBase; import mx.controls.Alert; import mx.controls.TextInput; private var currentSomeNumber:int; private function updateSomeNumber(event:Event):void { if (this["someNumber" + currentSomeNumber].text.length == 5) { var foo:String = "bar"; currentSomeNumber += 1; var temp:TextInput = new TextInput(); temp.id = "someNumber" + currentSomeNumber; temp.maxChars = 5; temp.addEventListener(Event.CHANGE, updateSomeNumber); temp.visible = true; someBoxes.addChild(temp); } } ]]></mx:Script> <mx:Form x="27" y="51" width="380" id="form"> <mx:FormItem x="209" label="Some Number" width="262"> <mx:HBox id="someBoxes"> <mx:TextInput width="110" id="someNumber1" text="" change="updateSomeNumber(event)" maxChars="5"/> </mx:HBox> </mx:FormItem> </mx:Form> </mx:Application -- ~~ http://www.lifesabirch.org <http://www.lifesabirch.org>