Groups | Blog | Home
all groups > flash actionscript > april 2006 >

flash actionscript : Kerning Dynamic Text through actionscript


Bill O
4/28/2006 10:34:41 PM
Hey,

i know there is a way to assign a numeric leading property to dynamic text
throught us the AS TextFormat class, and there is a boolean value to determine
if text is kerned or not through TextFormat.

What I want ot do is assign a kening number to the text like you can using the
property inspector when you drop a dynamic text instance on the Stage. Is this
possible.

I am creating a text field using AS and then manipulation it as such:


//What the textfield should say
var txtSho:String = "this is the text in the box";
//create a txt field
var someTxt:TextField = this.createTextField("txtFld1", 10, 0, 0, 10, 10);
//18 point Format
var txtFmt:TextFormat = new TextFormat();
txtFmt.font = "akSuper";
txtFmt.color = 0x000000;
txtFmt.kerning = true;
txtFmt.size = 18;
txtFmt.leading = 5;
//adjust the text field
txtFld1.autoSize = true;
txtFld1.antiAliasType = "advanced";
txtFld1.embedFonts = true;
txtFld1.mouseWheelEnabled = true;
txtFld1.type = "dynamic";
//put content in text field and format it
txtFld1.text = txtSho;
txtFld1.setTextFormat(txtFmt);
TimSymons
4/29/2006 3:11:17 AM
I think the property you are looking for is called "letterSpacing". Using your example:

txtFmt.letterSpacing = 10; // put 10 pixels before each character

Bill O
5/4/2006 7:28:08 PM
AddThis Social Bookmark Button