>From Programming ActionScript 3.0: "If you use Flex, you should know that Flex defines many component display object classes, and these classes override the display list access methods of the DisplayObjectContainer class. For example, the Container class of the mx.core package overrides the addChild() method and other methods of the DisplayObjectContainer class (which the Container class extends). In the case of the addChild() method, the class overrides the method in such a way that you cannot add all types of display objects to a Container instance in Flex. The overridden method, in this case, requires that the child object that you are adding be a type of mx.core.UIComponent object."
I'd be willing to bet that the MXML is calling addChild() and you haven't extended UIComponent. > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf > Of Sergey Kovalyov > Sent: Thursday, August 17, 2006 04:50 > To: [email protected] > Subject: [flexcoders] Instantiating object in MXML > > Hi All! > > I have MyObject class that implements IMXMLObject interface: > > package { > > import mx.core.IMXMLObject; > > public class MyObject implements IMXMLObject { > > public function initialized(document:Object, id:String):void { > } > > } > > } > > And application that instantiates this class instance: > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > xmlns:local="*"> > > <local:MyObject /> > > </mx:Application> > > But when I put <local:MyObject /> into <mx:VBox /> "Component > declarations are not allowed here. (Note: visual children must > implement mx.core.IUIComponent)" error appears: > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > xmlns:local="*"> > > <mx:VBox> > <local:MyObject /> > </mx:VBox> > > </mx:Application> > > > Though "native" RadioButtonGroup works ok everywhere. > > Sergey. > > > -- > 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/

