> var s:Sprite = new Sprite();
> var b:Box = new Box(); // box - mx.core.Container.Box

> then:
> b.addChild(s);// - ERROR: cannot convert 
> flash.display::[EMAIL PROTECTED] to mx.core.IUIComponent

> ------------
> i know (from debugger) that method 'addChild(val:DisplayObject)' in 
> mx.core.Container is overriden and it checks the argument 'val' 
> on "IUIComponent'ness" (sorry for my English:)).

> So, i can't add Sprite instance as a child to a Container instance.
> Is it true?
> It seems, it's not good...


You can wrap your Sprite inside an UIComponent (code not tested):

var s:Sprite = new Sprite();

var c:UIComponent = new UIComponent();
c.addChild(s);

var b:Box = new Box();
b.addChild(b);


I think the Flex Container can only accept UIComponents because it
needs the properties and methods they add to layout the children.


Jens




--
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/
 



Reply via email to