June 22nd, 2009 • 14 comments ActionScript, Flash
Tags: ActionScript, AS3, Flash, TextField
Because of the lack of text highlighting capabilities for Flash TextFields I coded a small class with a simple API to highlight text with your custom style. For your own styles you just have to implement an interface. The highlight method takes either a String or Regular Expression as argument.
The class doesn’t work for scrolling text at the moment, but feel free to extend the class.
example:
Read more »
Because of the lack of text highlighting capabilities for Flash TextFields I coded a small class with a simple API to highlight text with your custom style. For your own styles you just have to implement an interface. The highlight method takes either a String or Regular Expression as argument.
The class doesn't work for scrolling text at the moment, but feel free to extend the class.
example:
code:
// highlight container
var highlight : Sprite = new Sprite();
addChild(highlight);
// create textfield
var textField : TextField = new TextField();
addChild(textField);
// apply text style and add text
...
// highlight style
var style : IHighlightStyle = new SimpleHighlightStyle(0x00ff00, 0.5);
// highlighter
var textHighlighter : TextHighlighter = new TextHighlighter(textField, highlight, style);
textHighlighter.highlight(/far/gi);
textHighlig
June 18th, 2009 • 12 comments ActionScript, Flash
Tags: ActionScript, AS3, Flash, TextField
If you ever needed to style the bullet points in a Html TextField in Flash you have noticed that this isn’t supported. It gets even worse if the bullet point in the font you’re using isn’t nice at all and you want to take another fonts bullet point.
But with a simple workaround you can change the font face, size and color of the bullet points:
And don’t forget to embed the bullet point, it’s character U+2022
Update 25.01.2010
Added an indent property to easily set the left margin of the list. For using other symbols than the bullet, you have to manipulate your font and embed the manipulated character.
Download Source
If you ever needed to style the bullet points in a Html TextField in Flash you have noticed that this isn't supported. It gets even worse if the bullet point in the font you're using isn't nice at all and you want to take another fonts bullet point.
But with a simple workaround you can change the font face, size and color of the bullet points:
And don't forget to embed the bullet point, it's character U+2022
Update 25.01.2010
Added an indent property to easily set the left margin of the list. For using other symbols than the bullet, you have to manipulate your font and embed the manipulated character.
Down