actionscript 3 - AS3 - TextField: Embedded font -


this code not render text screen. changing,

drawtext.embedfonts = false; 

renders text, font size doesn't modify or color.

package {  import flash.display.sprite; import flash.text.textfield; import flash.text.textformat; import flash.text.*;  public class drawtext extends sprite {      private var drawtext:textfield;     private var myformat:textformat;      [embed(source="c:/windows/fonts/verdana.ttf", fontfamily="verdana", embedascff="false")]     private var verdana:class;     public function drawtext(mx:int,my:int){          myformat = new textformat("verdana");         myformat.size = 32;         myformat.color = 0x00ffff;          drawtext = new textfield();         drawtext.embedfonts = true;         drawtext.autosize = textfieldautosize.left;         drawtext.selectable = false;         drawtext.type = "dynamic";         drawtext.multiline=true;         drawtext.wordwrap=true;         drawtext.x = 128;         drawtext.y = 128;         drawtext.text = "test test test test test test test test test test";         drawtext.defaulttextformat = myformat;         addchild(drawtext);      }//end constructor  }//end class  }//end package 

it's frustrating appreciated. i'm using flash builder 4.6.

you should apply defaulttextformat before setting of text or use textfield.settextformat existed text

upd: embedfonts have register font class before using:

font.registerfont(verdana); 

upd2:

example (modify code in topic):

   //set defaulttextformat before set text     //and use settextformat format existed text     drawtext.defaulttextformat = myformat;    drawtext.settextformat(myformat);    drawtext.text = "test test test test test test test test test test"; 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -