Set text selection / border in ActionScript 3.0

How to set properties for text / border outline for each character in a line of text in AS3?

+5
source share
2 answers

I do not think you can. What you can do is use a blur filter to simulate the appearance of the outline. Just paste this into an empty AS3 movie:

var txt:TextField = new TextField();
this.addChild(txt);
txt.appendText('Lorem ipsum');
txt.autoSize = TextFieldAutoSize.LEFT;
txt.antiAliasType = flash.text.AntiAliasType.NORMAL;
txt.selectable = false;

var txtFormat:TextFormat = new TextFormat();
txtFormat.size = 40;
txtFormat.font = 'Helvetica';
txt.setTextFormat(txtFormat);
txt.defaultTextFormat = txtFormat;

var outline:GlowFilter = new GlowFilter();
outline.blurX = outline.blurY = 1;
outline.color = 0xFF0000;
outline.quality = BitmapFilterQuality.HIGH;
outline.strength = 100;

var filterArray:Array = new Array();
filterArray.push(outline);
txt.filters = filterArray;

Try playing with power, blurX, blurY and quality properties to get different appearances. I think about the closest you can go to the text outline.

PS: embedding fonts would significantly improve the quality of the effect, as well as improve anti-aliases.

+14
source

, ,
, , ,

0

All Articles