I'm trying to create a simple text with a drop shadow in ActionScript 3.0; for exa开发者_如何转开发mple:
_tf = new TextField();
_tf.autoSize = TextFieldAutoSize.CENTER;
_tf.selectable = false;
var format:TextFormat = new TextFormat();
format.font = "Arial";
format.bold = true;
format.color = 0xffffff;
format.size = 12;
_tf.text = "Drop shadow";
_tf.defaultTextFormat = format;
addChild(_tf);
How can i get this text with a drop shadow??
_tf.filters = [new DropShadowFilter()];
or even better;
_tf.filters = [filter(4,153,0xffffff,0.7,4,4,0.7,0.15,false,false,false)];
function filter(distance, angle, color, alpha, blurX, blurY, strength, quality, inner, knockout, hideObject){
return new DropShadowFilter(distance, angle, color, alpha, blurX, blurY, strength, quality, inner, knockout, hideObject);
}
other way:
_tf.filters = [new DropShadowFilter(4.0,45,0x000000,1.0,4.0,4.0,1.0,1,false,true,false)];
/*
DropShadowFilter(distance:Number = 4.0, angle:Number = 45, color:uint = 0, alpha:Number = 1.0, blurX:Number = 4.0, blurY:Number = 4.0, strength:Number = 1.0, quality:int = 1, inner:Boolean = false, knockout:Boolean = false, hideObject:Boolean = false);
DropShadowFilter
distance:Number = 4.0
angle:Number = 45
color:uint = 0
alpha:Number = 1.0
blurX:Number = 4.0
blurY:Number = 4.0
strength:Number = 1.0
quality:int = 1
inner:Boolean = false
knockout:Boolean = false
hideObject:Boolean = false
*/
documentation here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filters/DropShadowFilter.html
精彩评论