将蒙版添加到具有动态文本字段的父精灵时,文本会失去抗锯齿。我怎样才能保持文本的抗锯齿,同时仍然对其父级应用蒙版,然后对其自身应用蒙版。
字体是嵌入的,并且文本字段将被动画化,因此它也必须与其父级一起被屏蔽。
package
{
import flash.display.Sprite;
import flash.display.Shape;
import flash.text.*;
public class Test extends Sprite
{
public function Test()
{
//Create Background Canvas
var canvas:Sprite = new Sprite();
canvas.graphics.beginFill(0xFF0000)
canvas.graphics.drawRect(0, 0, 100, 100);
//Create Dynamic Text
var field:TextField = new TextField();
field.width = 100;
field.autoSize = TextFieldAutoSize.LEFT;
field.selectable = false;
field.text = "Dynamic\nText";
var format:TextFormat = new TextFormat();
format.font = "Myriad Pro";
format.color = 0xFFFFFF;
format.size = 14;
field.setTextFormat(format);
//Add Dynamic Text To Background Canvas
field.x = canvas.width /2 - field.width / 2;
field.y = canvas.height / 2 - field.height / 2;
canvas.addChild(field);
//Create Mask
var canvasMask:Shape = new Shape();
canvasMask.graphics.beginFill(0);
canvasMask.graphics.drawRoundRect(0, 0, 100, 100, 50);
//Add Background Canvas And Mask To Display List
// canvas.mask = canvasMask;
// addChild(canvasMask);
addChild(canvas);
}
}
}