Panel and other containers have a notion of content children vs rawChildren. Borders, titlebars, etc are rawChildren. It is a bit harder to do from MXML because we don't let you spec out your rawChildren in MXML, the default property is the content children. So, if you want rawChildren, I'd recommend AS subclassing. That way the numChildren and getChildAt calls make more sense to the consumer and aren't offset by stuff you stuck in there that they didn't know about. If you really gotta go the way of MXML, I think there is a way to use [DefaultProperty] to assign a property to an MXML container so all children are stuffed in there. I think there's an example on quietlyscheming.com.
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Stephen Roy J. Tang Sent: Wednesday, October 03, 2007 2:38 AM To: [email protected] Subject: [flexcoders] Extending Canvas? Hi, I'm trying to create an MXML component extending from canvas, with some predefined components (buttons and some graphical elements) and behaviors, but I also want any MXMLs using the component to be able to specify additional contents for the components. (Since it's a canvas, I assume it's the calling screen's responsibility to position it's children correctly.) Of course, first thing I tried is just to do it directly, and I get an error "Multiple sets of visual children have been specified...etc". Is what I'm thinking of possible? Any advice? I took a look at the source of another container class (Panel), which I assumed would do something similar, but it seems the code there is a bit more complicated that I would like. I'm hoping there's a simple way to specify that I want to accept visual children from both the component declaration and the component instance. Thanks, Roy

