1250 ActionScript classes
Example
The following example creates two anti-alias entries and two text fields to illustrate them. For
this example to work, the SWF file must have a shared font embedded with a linkage
identifier of
"myArial"
. To embed the font, follow these steps:
■
Open your Library.
■
Click the Library options menu in the upper-right corner of the Library.
■
Select New Font from the pop-up menu.
■
Name the font
myArial
.
■
Select Arial from the font pop-up menu.
■
Click OK.
■
Right-click the newly created font, and select Linkage.
■
Select the Export for ActionScript check box.
■
Click OK to accept the default identifier, myArial.
import flash.text.TextRenderer;
var antiAliasEntry_1 = {fontSize:24, insideCutoff:1.61, outsideCutoff:-
3.43};
var antiAliasEntry_2 = {fontSize:48, insideCutoff:0.8, outsideCutoff:-0.8};
var arialTable:Array = new Array(antiAliasEntry_1, antiAliasEntry_2);
var lbl_1:TextField = createLabel(0, 0, 300, 100, 24);
var lbl_2:TextField = createLabel(0, 100, 300, 100, 48);
TextRenderer.setAdvancedAntialiasingTable("Arial", "none", "dark",
arialTable);
function createLabel(x:Number, y:Number, width:Number, height:Number,
fontSize:Number):TextField {
var depth:Number = this.getNextHighestDepth();
var tmpTxt = this.createTextField("txt_" + depth, depth, x, y, width,
height);
tmpTxt.antiAliasType = "advanced";
tmpTxt.gridFitType = "pixel";
tmpTxt.border = true;
tmpTxt.text = "Hello World";
tmpTxt.embedFonts = true;
tmpTxt.setTextFormat(getTextFormat(fontSize));
return tmpTxt;
}
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...