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]
<mailto:[EMAIL PROTECTED]> > wrote:

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

 

 

 

 

 

Reply via email to