Yes it was confusing that the example on Adobe LiveDocs didn't work when plugged straight into a basic application.
Anyway, I tried the code and got it to output a bitmap of a TextField - however - it didn't look anything like the TextInput control. The font style and colour was different. I tried changing the background colour but the bitmap kept outputting it with a white background ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of gbkfortna Sent: 09 May 2007 20:32 To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Drawing text to screen / bitmap I was having trouble going over this and getting it to work. Would you mind taking the example code snippets below and put them together so it works within a small Flex application? Thanks, It would be greatly appreciated. Greg --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "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: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of Daniel Freiman > Sent: Wednesday, May 09, 2007 7:38 AM > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > 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: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> [mailto: flexcoders@ > <mailto:flexcoders@> yahoogroups.com <http://yahoogroups.com <http://yahoogroups.com> > ] On > Behalf Of Daniel Freiman > Sent: 09 May 2007 14:45 > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > 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 <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? >