Skip to main content
Participant
December 21, 2009
Question

Letter spacing using action script??

  • December 21, 2009
  • 1 reply
  • 1986 views

I am using Cu3er plug-in and I am using an embedded font to allow for a fade in/out effect.  My only problem is the kerning is to tight, id there a way to adjust the letterspacing using action script?

-Jeff

This topic has been closed for replies.

1 reply

December 21, 2009

Have a look at the letterSpacing property of the TextFormat class.

Participant
December 21, 2009

I applied the letterspacing property but my .swf file did not work correctly afterwards.  This is how I created the embedded font, and when I add the letterspacing property it doesn't work correctly.

  1. under library, right-click and choose "New Font ..."
  2. under the "Name" field type the name of the font "myFont"
  3. select font & style from the respective drop down menus
  4. Click "advanced > linkage" and check "Export for Actionscript" and "Export in first frame"
  5. Click OK
  6. Open 'ActionScript panel' and register font by typing following AS code:
    Font.registerFont(myFont);
  7. Publish this swf for Flash Player 9 with Actionscript 3
  8. Copy/move published font .swf into the desired folder and set variable 'font' with the path to the .swf file inside your embedding script in order to make the CU3ER to use your defined font.

This is my actionscript...

Font.registerFont(myFont);

myFont.letterSpacing=2;

December 21, 2009

I'm not sure about the use of the CU3ER but letterSpacing is a property of the TextFormat class, not of Font. Typically you would do something like:

var myFormat:TextFormat = new TextFormat();

myFormat.letterSpacing = -.6;

someTextField.setTextFormat(myFormat);