tags:

views:

23

answers:

1

Hi, I have an Item Renderer having HBox. Now I want to add child in that HBox from my application file using addChild method. Could anybody please suggest me the way around for the same. I am not able to access the properties of HBox inside the item renderer.

Thanks in advance!

A: 

Don't try to do that - even if you get a reference to the instance of item renderer and make modifications to it (addChild or whatever), you'll loose it when the item renderers are recycled. And item renderers are frequently recycled - for example when you scroll the list. If the list has 100 items and only 10 are visible at a given time, only 11 or so instances of item renderers will be created. Those instances will be showed in a cycle - when you scroll, the data in them are updated using the set data method.

Override the set data method in the item renderer and do the stuff from there.

Amarghosh
Thanks Amarghosh for reply, well on selection of some checkboxes I want to add child in the HBox of the item renderer, so can i achieve that with this. I am newbie in flex so getting bit confused with this.
shruti
In this case then will I be needed to access the application collections? as in on selection of some checkboxes i want to add that no. of hbox in my selected rows... so here i'll need to access the array collection of those selected checkboxes in my main application right??
shruti