Yes. I am using Flex 2 Beta 1. When you run the application and click on Alpha, is a button appearing underneath Alpha, or Beta? It should be Alpha.
Thanks. Tobias. --- In flexcoders@yahoogroups.com, "Eric D Anderson" <[EMAIL PROTECTED]> wrote: > > Hi, > > I tried this with the Flex 2 beta and I don't see any problem. Can you confirm you're using Flex 2 beta? > > Thanks > > Eric > > -----Original Message----- > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of tobiaspatton > Sent: Thursday, February 09, 2006 6:42 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Problem with listItemRenderer and AddChild > > Hi again; > > This might be a bug. The code at the end of this message creates a > list with a custom item renderer. The renderer handles clicks by > changing the component's state, effectively adding a button. > > This works fine as long as the list property `variableRowHeight' is > set to `false'. If it it set to true, very strange things happen. > Clicking on the first row adds a button to the second row. > Repeatedly clicking on the first row will add a button to the second > row, remove it, add it to the first row and then remove it. > > Does anyone know a way to dynamically add and remove children from a > custom list item renderer that allows variable height rows? > > Thanks. > Tobias. > > Here's the code: > > ----- TestAddChild.mxml ----- > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" > xmlns="*" layout="absolute"> > <mx:ArrayCollection id="ac"> > <mx:Array> > <mx:String>Alpha</mx:String> > <mx:String>Beta</mx:String> > </mx:Array> > </mx:ArrayCollection> > > <mx:VBox id="vb" width="300"> > <mx:List variableRowHeight="true" > rowHeight="60" > dataProvider="{ac}" > listItemRenderer="ItemRenderer" > width="300"/> > </mx:VBox> > </mx:Application> > > ----- ItemRenderer.mxml ----- > > <?xml version="1.0" encoding="utf-8"?> > <mx:VBox xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*" > click="DoItemClick(event)" > height="60"> > <mx:Script> > <![CDATA[ > public function DoItemClick( > event:MouseEvent ):void > { > currentState = ( currentState == > null ) ? "openState" : null; > } > ]]> > </mx:Script> > > <mx:states> > <mx:State name="openState"> > <mx:AddChild> > <mx:Button label="{dataObject}"/> > > </mx:AddChild> > </mx:State> > </mx:states> > > <mx:Label text="{dataObject}"/> > > </mx:VBox> > > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders% 40yahoogroups.com > Yahoo! Groups Links > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/