Tracy, thanks for the feedback. The above was just an example of an issue I ran into while trying to build a larger menu component. I don't have much experience with the mx:Repeater control so I will look into it more.
I originally tried to build the component using MXML and nested containers, but one of the main issues I ran into was that all box containers, and I think the repeater falls into this category too, position their child elements based on the childIndex value. This is undesirable in my case. For instance, if I have three buttons stacked on top of each other vertically (think List control), I need button 1 to have a dropshadow on top of button 2. I've been contemplating subclassing VBox to see if I can override the positioning logic but I ran into the above issue and need to figure out the best solution to get the height of a container after dynamically adding children so I can reposition other UIComponents at runtime based on the UIComponent's height. Seems like I'm missing something simple here... --- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > For creating multiples of the same component, consider using > mx:Repeater. It handles many ugly details for you. If, for example, > you wanted to remove the children you created using addChild, it would > take some thought and some code, further complicated if there are static > components in the container as well. With Repeater, just do: > myRepeater.dataProvider.removeAll(); > > Tracy > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Alex Harui > Sent: Tuesday, November 27, 2007 12:14 PM > To: [email protected] > Subject: RE: [flexcoders] This has to be a bug right? If not, please > explain... > > > > Flex uses an invalidation mechanism. As properties change, flags are > set requesting validation of those properties at a later time. You can > force validation by calling validateNow(), but it can be expensive. > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Justin Winter > Sent: Tuesday, November 27, 2007 9:10 AM > To: [email protected] > Subject: [flexcoders] This has to be a bug right? If not, please > explain... > > added to a creationComplete handler function: > > <code> > var vBox:VBox = new VBox(); > > for(var i:int = 0; i < 10; i++) > { > var tmpBtn:Button = new Button(); > tmpBtn.label = "BUTTON: " + i; > vBox.addChild(tmpBtn); > } > > this.addChild(vBox); > > trace('VBOX HEIGHT: ' + vBox.height); > </code> > > OUTPUT: > ------ > VBOX HEIGHT: 0 <- ALWAYS ZERO > > No matter if I call vBox.invalidateProperties(); or any of the other > invalidate functions. The buttons are added to the container fine and > are displayed fine. > > I've also tried this with several other containers and the height is > not updated after the children are added. What am I missing here? >

