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]
<mailto:[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: flexcoders@
<mailto:flexcoders@> yahoogroups.com <http://yahoogroups.com> ] 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]
<mailto:[EMAIL PROTECTED]> > wrote:

        Hi, is it possible to draw text to the screen or to a bitmap in
Flex?

         

         

         

         

        

        

        


 

Reply via email to