Exactly - the method I provided uses a simple transport mechanism to get the
string into a graphics context. that perhaps could be used with
beginBitmapFill or a programmatic skin. As you say, without an API to do
this directly. hmm. I feel a feature request coming on.

 

Rick Winscot

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Gordon Smith
Sent: Tuesday, April 15, 2008 8:51 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Writing text directly to Graphics object.

 

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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Rick Winscot
Sent: Tuesday, April 15, 2008 5:30 PM
To: flexcoders@yahoogroups.com
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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Gordon Smith
Sent: Monday, April 14, 2008 8:23 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Writing text directly to Graphics object.

 

Unfortunately, the answer is "no".

 

Gordon Smith

Adobe Flex SDK Team

 

  _____  

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Eric Cooper
Sent: Friday, April 11, 2008 3:50 PM
To: flexcoders@yahoogroups.com
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

 

<<image001.jpg>>

<<image002.jpg>>

Reply via email to