实现动态文本的描边及阴影效果
//利用filters滤镜包里的GlowFilter和DropShadowFilter,我们很容易实现PS中的文字描边、阴影等效果。
//下面只是针对比较常用的12px的宋体描边和阴影效果的演示代码:
//文字描边效果
var
tf1 = _root.createTextField("tf1", _root.getNextHighestDepth(), 10, 10, 0,
0);
tf1.autoSize = true;
tf1.text = "AS描边文字效果演示";
tf1.textColor =
0xFFFF00;
var myGlowFilter = new flash.filters.GlowFilter(0x000000, 1, 2, 2,
10, 1, false, false);
var myFilters:Array =
tf1.filters;
myFilters.push(myGlowFilter);
tf1.filters =
myFilters;
//文字阴影效果
var tf2 = _root.createTextField("tf2",
_root.getNextHighestDepth(), 10, 30, 0, 0);
tf2.autoSize = true;
tf2.text
= "AS阴影文字效果演示";
tf2.textColor = 0x000000;
var myDropFilter = new
flash.filters.DropShadowFilter(1, 45, 0xFFFFFF, 1, 1, 1, 10, 1, false,
false);
var myFilters2:Array =
tf2.filters;
myFilters2.push(myDropFilter);
tf2.filters = myFilters2;
///////////////////////////////////////////////////////////
////文字描边效果
//var tf1 = root.createTextField("tf1", _root.getNextHighestDepth(), 10, 10, 0, 0);
//tf1.autoSize = true;
//tf1.text = "AS描边文字效果演示";
//tf1.textColor = 0xFFFF00;
var myGlowFilter = new flash.filters.GlowFilter(0x000000, 1, 3, 3, 10, 1, false, false);
var myFilters:Array = tf1.filters;
myFilters.push(myGlowFilter);
tf1.filters = myFilters;
//文字阴影效果
//var tf2 = root.createTextField("tf2", root.getNextHighestDepth(), 10, 30, 0, 0);
//tf2.autoSize = true;
//tf2.text = "AS阴影文字效果演示";
//tf2.textColor = 0x000000;
var myDropFilter = new flash.filters.DropShadowFilter(1, 45, 0x000000, 1, 1, 1, 10, 1, false, false);
var myFilters2:Array = tf2.filters;
myFilters2.push(myDropFilter);
tf2.filters = myFilters2;
//下面只是针对比较常用的12px的宋体描边和阴影效果的演示代码:
//文字描边效果
var
tf1 = _root.createTextField("tf1", _root.getNextHighestDepth(), 10, 10, 0,
0);
tf1.autoSize = true;
tf1.text = "AS描边文字效果演示";
tf1.textColor =
0xFFFF00;
var myGlowFilter = new flash.filters.GlowFilter(0x000000, 1, 2, 2,
10, 1, false, false);
var myFilters:Array =
tf1.filters;
myFilters.push(myGlowFilter);
tf1.filters =
myFilters;
//文字阴影效果
var tf2 = _root.createTextField("tf2",
_root.getNextHighestDepth(), 10, 30, 0, 0);
tf2.autoSize = true;
tf2.text
= "AS阴影文字效果演示";
tf2.textColor = 0x000000;
var myDropFilter = new
flash.filters.DropShadowFilter(1, 45, 0xFFFFFF, 1, 1, 1, 10, 1, false,
false);
var myFilters2:Array =
tf2.filters;
myFilters2.push(myDropFilter);
tf2.filters = myFilters2;
///////////////////////////////////////////////////////////
////文字描边效果
//var tf1 = root.createTextField("tf1", _root.getNextHighestDepth(), 10, 10, 0, 0);
//tf1.autoSize = true;
//tf1.text = "AS描边文字效果演示";
//tf1.textColor = 0xFFFF00;
var myGlowFilter = new flash.filters.GlowFilter(0x000000, 1, 3, 3, 10, 1, false, false);
var myFilters:Array = tf1.filters;
myFilters.push(myGlowFilter);
tf1.filters = myFilters;
//文字阴影效果
//var tf2 = root.createTextField("tf2", root.getNextHighestDepth(), 10, 30, 0, 0);
//tf2.autoSize = true;
//tf2.text = "AS阴影文字效果演示";
//tf2.textColor = 0x000000;
var myDropFilter = new flash.filters.DropShadowFilter(1, 45, 0x000000, 1, 1, 1, 10, 1, false, false);
var myFilters2:Array = tf2.filters;
myFilters2.push(myDropFilter);
tf2.filters = myFilters2;