You can loop through looking for the child with ID "x", or keep a reference
to it like you would any other variable.

var createdChildren : Object = {};

private function Test():void
{
 for(var i:int = 0; i<length.sArray;i++){
   var ti1:TextInput = new TextInput();
   ti1.editable = false;
   ti1.id = "Name__" + sArray[i].ID;
   createdChildren[ti1.id] = ti1;
   addChild(ti1);
 }
}

Then retrieve it like so:

myTextField = createdChildren["someId"];

-Josh

On Fri, Jul 18, 2008 at 2:41 PM, timgerr <[EMAIL PROTECTED]> wrote:

> Hello all,
> Yes it is me back asking more questions about dynamic ActionScript.
> Here is my problem, I have this  object that I populate a textimput box
> Here us some of the code:
> [Bindable]
> public var sArray:Object = [{Name:"Jane Doe",Age:"26",ID:"5"}];
>
> private function Test():void
> {
>  for(var i:int = 0; i<length.sArray;i++){
>    var ti1:TextInput = new TextInput();
>    ti1.editable = false;
>    ti1.id = "Name__" + sArray[i].ID;
>    addChild(ti1);
>  }
> }
> So now I have this TextInput with the id of Name__5, I would like to
> create a function to set the editable to true, so I create somting
> like this
>
> private function Enable():void
> {
>  for(var i:int = 0; i<length.sArray;i++){
>     ti1.id = "Name__" + sArray[i].ID.editable = true;
>  }
> }
>
> at the code:
>  ti1.id = "Name__" + sArray[i].ID.editable = true;
> I am getting a "1050: Cannot assign to a non-reference value" error.
> How can I create a id to do somting when it has not been created yet?
>
> Thanks for the help,
> timgerr
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>


-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]

Reply via email to