View comments | RSS feed

antiAliasType (TextField.antiAliasType property)

public antiAliasType : String

The type of anti-aliasing used for this TextField instance. Advanced anti-aliasing is available only in Flash Player 8 and later. You can control this setting only if the font is embedded (with the embedFonts property set to true). For Flash Player 8, the default setting is "advanced".

To set values for this property, use the following string values:

String value

Description

"normal"

Applies the regular text anti-aliasing. This matches the type of anti-aliasing that Flash Player used in version 7 and earlier.

"advanced"

Applies advanced anti-aliasing, which makes text more legible. (This feature is available as of Flash Player 8.) Advanced anti-aliasing allows for high-quality rendering of font faces at small sizes. It is best used with applications that have a lot of small text. Advanced anti-aliasing is not recommended for fonts that are larger than 48 points.

Availability: ActionScript 1.0; Flash Player 8

Example

This example creates two text fields and applies advanced anti-aliasing to the first one only. It assumes that you have a font embedded in the Library with the linkage identifier set to "Times-12". To embed the font, follow these steps:

var my_format:TextFormat = new TextFormat();
my_format.font = "Times-12";

var my_text1:TextField = this.createTextField("my_text1", this.getNextHighestDepth(), 10, 10, 300, 30);
my_text1.text = "This text uses advanced anti-aliasing.";
my_text1.antiAliasType = "advanced";
my_text1.border = true;
my_text1.embedFonts = true;
my_text1.setTextFormat(my_format); 

var my_text2:TextField = this.createTextField("my_text2", this.getNextHighestDepth(), 10, 50, 300, 30);
my_text2.text = "This text uses normal anti-aliasing."
my_text2.antiAliasType = "normal";
my_text2.border = true;
my_text2.embedFonts = true;
my_text2.setTextFormat(my_format);

If your SWF file includes a version 2 component, use the version 2 components DepthManager class instead of the MovieClip.getNextHighestDepth() method, which is used in this example.

See also

TextRenderer (flash.text.TextRenderer), gridFitType (TextField.gridFitType property), thickness (TextField.thickness property), sharpness (TextField.sharpness property)


Version 8

Comments


johnnystorm0 said on Aug 9, 2006 at 2:05 PM :
I've encounterd a bug with antiAliasType "advanced" and Window's clearType feature.

It seems that the two are incompatible, as of yet I have been unable to find a solution, or any reference to the problem.
johnnystorm0 said on Aug 18, 2006 at 8:13 AM :
There is a bug using antiAliasType = "advanced" and Windows XP's ClearType font rendering.

In some cases it causes the fonts to appear distorted (missing characters) when combined with cacheAsBitmap it may cause the browser to crash.
No screen name said on Dec 1, 2006 at 1:41 AM :
What about applying advanced anti-aliasing to the text within a comboBox?

Is it possible to do something like this, I can't get it to work:

_global.style.setStyle("antiAliasType", "advanced");
No screen name said on Apr 16, 2007 at 2:01 PM :
there's another bug:
if the antiAliasType is set to "advanced", embedFonts = true; and the textfield uses a monospaced font, the characters in the textfield aren't monospaced anymore.

this behaviour also applies to textfields created with the authoring tool, using antialias for readability and embeded monospaced fonts

is there any workaround for this issue?
allandt said on May 18, 2007 at 8:14 AM :
you have to use _global.styles (not style)

but i still haven't managed to get this to work

_global.styles.TextArea.setStyle("antiAliasType", "advanced");

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00002733.html