Flex默认的字体无法达到美术要求的效果,又不能采用贴图的形式
所以就必须对控件进行定制。所幸AS脚本是面对对象的编程语言,我
们可以继续Flex框架的控件类,实现我们自己所需要的控件类型。
下面以Button类为例子,我们要实现一个描边字体的按钮。代码
如下:
import flash.filters.GlowFilter;
import mx.controls.Button;
public class EnhancedButton extends Button
{
public function EnhancedButton
{
super();
}
override protected function commitProperties():void
{
super().commitProperties();
var glow:GlowFilter = new GlowFilter(0x363209,1,2,2,255);
var arr: Array = new Array();
arr.push(glow);
this.textField.filters = arr;
}
}