Thanks for the response. I can live with it and I have a simple work around.
Although I have noticed atleast two examples the assume a sprite can be passed into a "addChild" function. I can't tell whose addChild was being called, the code itself is not explicit and I don't know enough to be aware of any implicit types. Example: http://livedocs.adobe.com/flex/201/langref/flash/display/Sprite.html#hitArea Thanks again, Mike Power --- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote: > > Actionscript does not allow overriding of function signatures, otherwise > we would have done that. Because we can't do that, you have to live > with "rules". The rules in flex are: > > Navigator children must be containers > Container children must be IUIComponents > UIComponent children can be anything. > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of dodtsair > Sent: Tuesday, October 02, 2007 10:11 AM > To: [email protected] > Subject: [flexcoders] Bug? Flex breaks composite design pattern > > > > 1. Sprite is both a DisplayObjectContainer and a DisplayObject. > 2. A DisplayObjectContainer (like Application) has the function > addChild(child:DisplayObject):DisplayObject. > > Thus I should be able to call addChild and pass it a Sprite. However > I can't and I get the error "TypeError: Error #1034: Type Coercion > failed: cannot convert flash.display::[EMAIL PROTECTED] to > mx.core.IUIComponent." > > So it seems that the documentation and/or the implementation is wrong? > You should be able to pass a sprite into addChild? Maybe I made a > typo and just have not caught it? > > Here is the app used to produce the error: > > <?xml version="1.0" encoding="utf-8"?><mx:Application > xmlns:mx="http://www.adobe.com/2006/mxml > <http://www.adobe.com/2006/mxml> " layout="absolute" > creationComplete="init()"> > > <mx:Script> > > <![CDATA[ > > internal function init(): void > > { > > this.addChild(new Sprite()); > > } > > ]]> > > </mx:Script> > > </mx:Application> > > I have seen several examples use this same call, I can fix it by using > a class that is derived from Sprite and IUIComponent. > > Mike Power >

