Flex container children must be IUICOmponents. Bitmap is not. You can make it a child of a UIComponent or the source to Image if you want.
Alex Harui Flex SDK Developer Adobe Systems Inc.<http://www.adobe.com/> Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of flexaustin Sent: Thursday, June 04, 2009 9:13 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] cannot convert flash.display::Bitmap to mx.core.IUIComponent. Why would I be getting this error? <Canvas xmlns="http://ns.adobe.com/mxml/2009" width="100%" height="100%" maxHeight="125" maxWidth="125"> <Script> <![CDATA[ import flare.util.Displays; import flash.display.BitmapData; // Take a bitmapdata object and shove it in the bitmapholder canvas public function shoveInBitmap( bm:BitmapData) : void { bitmapHolder.addChild( new Bitmap(bm) ); } // Clear out all children from bitmapholder canvas public function clearBitmap() : void { bitmapHolder.removeAllChildren(); } ]]> </Script> <Group id="backGroundForZP" width="100%" height="100%" left="0" top="0" > <Rect height="100%" width="100%" left="0" top="0" > <fill> <SolidColor color="0x000000" /> </fill> <stroke> <SolidColorStroke color="0xCCCCCC" weight="2" /> </stroke> </Rect> </Group> <Group id="mainBMPHolder" width="80%" height="80%" left="{ (backGroundForZP.parent.width - mainBMPHolder.width) / 2}" top="{ (backGroundForZP.parent.height - mainBMPHolder.height) / 2}"> </Group> <Canvas id="bitmapHolder" backgroundColor="0xCCCCCC" width="100%" height="100%"> </Canvas> </Canvas>