"If you add an id to a component created at runtime, that id can't be
used as a reference to 
it.", precisely.  It is just a string property of the component and the
parent component knows nothing about it.

 

An id on an mxml tag works as a reference because the compiler creates
an instance variable with the name specified in the id property, and
assigns a reference to the component instance to it.

 

If you manually addChild(), you need to do the same.

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Amy
Sent: Friday, November 21, 2008 9:47 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: setting tileList.id in this.addChild(tileList)
actionscript ...

 

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Mic" <[EMAIL PROTECTED]> wrote:
>
> var tileList:TileList = new TileList;
> tileList.dataProvider = thumbArray;
> this.addChild(tileList);
> 
> Although dataprovider is set, it is not getting bound, so I think I 
need
> 
> override public function initialize():void
> {
> BindingUtils.bindProperty(id of tileList, "dataProvider", 
this, 
> "thumbArray");
> super.initialize(); 
> }
> 
> But I cannot find a way of setting the tileList child id to e.g.
> "myTileList" so I can talk to it. TIA,

(1) An array is always equal to itself, no matter how many changes 
you make to it, so you can't bind to it unless you broadcast change 
events for it manually. Use an ArrayCollection instead.

(2) You already have a reference to tileList. If you add an id to a 
component created at runtim, that id can't be used as a reference to 
it.

HTH;

Amy

 

Reply via email to