I stand corrected.  That was sloppy work by me.  Of course since Bitmap
extends DisplayObject it can be a child of a DisplayObjectContainer,
generally speaking.  Sorry for any confusion.

Dan Freiman

On 5/9/07, Alex Harui <[EMAIL PROTECTED]> wrote:

   To be clear, you can add bitmaps as children, but you cannot add them
as children of Flex containers as their children must implement
IUIComponent.  You can add it as a child of UIComponent and add that to a
container.

 ------------------------------
*From:* [email protected] [mailto:[EMAIL PROTECTED] *On
Behalf Of *Daniel Freiman
*Sent:* Wednesday, May 09, 2007 7:38 AM
*To:* [email protected]
*Subject:* Re: [flexcoders] Drawing text to screen / bitmap

 You don't add bitmaps as children.  Instead you draw them using the
Graphics class.

this.graphics.beginBitmapFill(bitmapData);
this.graphics.drawRect(0,0,bitmapData.width,bitmapData.height);



On 5/9/07, Mark Ingram <[EMAIL PROTECTED]> wrote:
>
>    Hi, I have tried the following code from Adobe's site, but I receive
> the runtime error: Error #1034: Type Coercion failed: cannot convert
> flash.display::[EMAIL PROTECTED] to mx.core.IUIComponent.)
>
>
>
> var text:TextField = new TextField();
>
>                                     text.text = "Testing!";
>
>
>
>                                     var bitmapData:BitmapData = new
> BitmapData(80, 20);
>
>                                     bitmapData.draw(text);
>
>
>
>                                     var bitmap:Bitmap = new
> Bitmap(bitmapData);
>
>                                     this.addChild(bitmap);
>
>
>
> What am I doing wrong? I called that from creationComplete in my
> application.
>
>
>
>
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto: [EMAIL PROTECTED]
> *On Behalf Of *Daniel Freiman
> *Sent:* 09 May 2007 14:45
> *To:* [email protected]
> *Subject:* Re: [flexcoders] Drawing text to screen / bitmap
>
>
>
> The only way to render text is through flash.text.TextField, or
> StaticText.  You can then draw that text into a bitmap using
> flash.display.BitmapData.draw() to draw the TextField to a bitmap.
>
> Daniel Freiman
> nondocs <http://nondocs.blogspot.com>
>
> On 5/9/07, *Mark Ingram* <[EMAIL PROTECTED] > wrote:
>
> Hi, is it possible to draw text to the screen or to a bitmap in Flex?
>
>
>
>
>
>
>
>
>
>

Reply via email to