I figured it out;

Add an addEventListener FlexEvent.UPDATE_COMPLETE to the List component, and in 
the event function;

         public function eventcalledfunction(event:FlexEvent):void {
             if (List.dataGroup.getElementAt(0) == null)
                 return;
             var newVar:ArrayCollection = new ArrayCollection();
             newVar = this.parentDocument.formArray as ArrayCollection;
             var i:int = 0;
             var j:int = 0;
             
             for (i=0;i<List.dataGroup.numElements;i++) {
                 var rRenderer:ListRenderer = List.dataGroup.getElementAt(i) as 
ListRenderer;
                 var rPanel:Panel = rRenderer.panelComponent as Panel;
                 rPanel.removeAllElements();
             }   
             
             for (i=0;i<newVar.length;i++) {
                 var sRenderer:ListRenderer = List.dataGroup.getElementAt(i) as 
ListRenderer;
                 var sPanel:Panel = sRenderer.panelComponent as Panel;
                 sPanel.addElement(newVar[i]); 
             }
         }



Randy

--- In flexcoders@yahoogroups.com, Alex Harui <aha...@...> wrote:
>
> I'd add more smarts to the ItemRenderers so they can add the elements 
> themselves.
> 
> 
> On 5/29/10 7:56 AM, "Netaman" <rtigr...@...> wrote:
> 
> 
> 
> 
> 
> 
> I have a spark List that uses an itemRenderer to add a empty panel. I then 
> have a dynamic list of components that I need to add to each panel in the 
> List. How can I addElement to the itemRenderer panel in the List, after the 
> list is displayed?
> 
> I have seen the List dataGroup indexToRenderer array and would be perfect, 
> but it is a private variable, I have looked for a function that would 
> retrieve the index, but sadly could not find one.
> 
> Any help would be appreicated, thanks
> 
> Randy
> 
> 
> 
> 
> 
> 
> --
> Alex Harui
> Flex SDK Team
> Adobe System, Inc.
> http://blogs.adobe.com/aharui
>


Reply via email to