addChild expects an mx.core.iUIComponent which Bitmap is not.  You're data
types are not matching up because you are adding everything to a Canvas.
You'll probably need to write a custom component that contains a public
property to store your bitmap children to.

 

Jake Churchill
CF Webtools
11204 Davenport, Ste. 100
Omaha, NE  68154
 <http://www.cfwebtools.com> http://www.cfwebtools.com
402-408-3733 x103

From: [email protected] [mailto:[email protected]] On
Behalf Of flexaustin
Sent: Thursday, June 04, 2009 11:13 AM
To: [email protected]
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>



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.339 / Virus Database: 270.12.53/2154 - Release Date: 06/04/09
05:53:00

Reply via email to