2010年11月15日 星期一

[AS3] TextField.embedFonts屬性 + TextField.AntiAliasType類別 + TextField.thickness屬性



TextField.embedFonts = true; //指定是否要使用內嵌的字體外框顯示。
TextField.antiAliasType = AntiAliasType.ADVANCED;
thickness : Number 在這個文字欄位中,Glyph 邊緣的粗細。thickness的屬性值範圍在 -200~200之間。




摘錄Flash Help一句話:

flash.text.TextField.antiAliasType 屬性必須有值 AntiAliasType.ADVANCED,才能讓您設定銳利度、粗細或gridFitType 屬性,或使用 TextRenderer.setAdvancedAntiAliasingTable() 方法。

當然, 前提得先 TextField.embedFont = true;



比較銳利度:
1. 未定義antiAliasType屬性



2.TextField.antiAliasType = AntiAliasType.ADVANCED;


3.TextField.antiAliasType = AntiAliasType.NORMAL;



● 顯然  2.TextField.antiAliasType = AntiAliasType.ADVANCED 是比較銳利清晰。


SWF ---> TextField.antiAliasType = AntiAliasType.ADVANCED




SWF --- TextField.thickness = 200;



//
import flash.display.Loader;
import flash.net.URLRequest;
import flash.text.TextFormat;
import flash.text.TextField;
//
var ldr:Loader = new Loader();
//載入外部擁有字型分享資訊的swf檔
ldr.load(new URLRequest("991115_shareFont_2.swf"));
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, lcHandler);
//
function lcHandler(e:Event):void
{
 //*******將字体清單的裝置字體設為false,所以字型清單陣列僅剩下"嵌入字型"
 //所引入的嵌入字型只有一個
 var embededFonts:Array = Font.enumerateFonts(false);
 trace("991115_TextField.embedFonts_3.swf裡的嵌入字型為 " + embededFonts[0].fontName);
 //
 var aTextFormat:TextFormat = new TextFormat();
 //******所引入的嵌入字型只有一個,其名稱就是embededFonts[0].fontName
 aTextFormat.font = embededFonts[0].fontName;
 trace("aTextFormat.font = " + aTextFormat.font);
 aTextFormat.color = 0xffffff;
 aTextFormat.size = 16;
 //letterSpacing - 字元間距
 aTextFormat.letterSpacing = -1;
 aTextFormat.leftMargin = 15;
 aTextFormat.rightMargin = 15
 aTextFormat.target = "_blank";
 //aTextFormat.url = "";
 //
 var aTextField:TextField = new TextField();
 //*******在文字欄位實體設定embedFonts(嵌入字型)屬性為真
 aTextField.embedFonts = true;
 aTextField.multiline = true;
 aTextField.wordWrap = true;
 aTextField.background = true;
 aTextField.backgroundColor = 0xff2288;
 aTextField.x = 10;
 aTextField.y = 10;
 aTextField.width = 530;
 //aTextField.height = 200;
 aTextField.autoSize = TextFieldAutoSize.LEFT;
 //***Flash Help:進階消除鋸齒功能能讓小型文字顯示高品質的字體外觀, 
 //特別適用於含有許多小型文字的應用程式。 
 //對於非常大的字體 (大於 48 點) 則不建議使用進階消除鋸齒的功能。
 //見http://help.adobe.com/zh_TW/Flash/CS5/AS3LR/flash/text/AntiAliasType.html
 aTextField.antiAliasType = AntiAliasType.ADVANCED;
 //aTextField.antiAliasType = AntiAliasType.NORMAL;
 //thickness : Number  在這個文字欄位中,Glyph 邊緣的粗細。
 //thickness的屬性值範圍在 -200 ~ 200之間。
 aTextField.thickness = 200;
 //
 aTextField.defaultTextFormat = aTextFormat;
 aTextField.text = "Oh, Microsoft. You just can’t seem to help but be the last one to every party you attend. You launched the Kin just as messenger phones began to die, then you launched Windows Phone 7 when the smartphone wars were so far underway that most folks had already declared an allegiance.And now you’ve got your motion gaming platform, the Kinect, hitting the shelves years after the Nintendo Wii and months after the Playstation Move. I’ve spent the last week living with a Kinect in my life. How does it fare? Find out after the jump.Short Version:The Kinect isn’t bad. Not at all. It also, however, is not great.. yet. Of the six launch titles I tested, there’s only one that I’d whole-heartedly recommend and proves to me that the platform might be worthwhile. A few of the others are worthwhile rentals — and unlike the PS3 Move’s “KungFu Rider”, none of them made me want to throw the whole thing into a fire.Oh — and if one of your primary interests in the Kinect is using it to navigate through the 360 interface, you’ll want to hold off. Kinect support on the dashboard is currently pretty slow, and pretty clunky.";
 //aTextField.setTextFormat(aTextFormat);
 addChild(aTextField);
}


SWF --- TextField.thickness = -200;



適用於 Adobe  Flash  Professional CS5 的 ActionScript  3.0 參考__flash.text.TextField.thickness屬性

適用於 Adobe  Flash  Professional CS5 的 ActionScript  3.0 參考__flash.text.TextField.gridFitType屬性

沒有留言: