I think the original poster was looking for something like
graphics.drawText("Hello", format);
But there are (alas!) no APIs in the Graphics class that know how to
render a text string. Only TextField knows how to do that.
Gordon Smith
Adobe Flex SDK Team
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Rick Winscot
Sent: Tuesday, April 15, 2008 5:30 PM
To: [email protected]
Subject: RE: [flexcoders] Writing text directly to Graphics object.
There is a way to draw a string to an graphical control (i.e. Image) as:
private function drawStringOnImage( string:String, image:Image ):void
{
var t:UITextField = new UITextField();
t.text = string;
var b:BitmapData = new BitmapData( t.textWidth, t.textHeight, true,
0x000000 );
b.draw( t );
image.source = new BitmapAsset( b );
}
If you wanted to draw this on something like the canvas... well - you
*could* take a dynamic skinning approach.
Rick Winscot
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Gordon Smith
Sent: Monday, April 14, 2008 8:23 PM
To: [email protected]
Subject: RE: [flexcoders] Writing text directly to Graphics object.
Unfortunately, the answer is "no".
Gordon Smith
Adobe Flex SDK Team
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Eric Cooper
Sent: Friday, April 11, 2008 3:50 PM
To: [email protected]
Subject: [flexcoders] Writing text directly to Graphics object.
Is there any way to write/draw text directly to a Graphics object? For
that matter is there
anyway to draw text (single line of static text) into a Canvas? I
suspect that the answer is "no",
having searched and searched... but maybe there's some obscure utility
class that I've
overlooked.
Thanks in advance.
-Eric