Introduction to com.doitflash.text.TextArea (Part 3)
You’re able to use basic CSS for styling your HTML content being used in TextFields via the htmlText property. you can change the color, size or put an underline when rolling over an href link in TextField.
it’s good and makes your content look better, but what if you want to call a custom function when you mouse over a link? what if, I donno, what if you have a tooltip enabled in your project and wish to show a tooltip window when you mouse over a specefic link in your text block?
TextArea is here to help you with that! with a little change in your html content and you will be able to call custom functions inside your text blocks.
If you have not downloaded the TextArea class yet > http://doitflash.com/, download it now. install the classes in your class path and try the following sample code below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import flash.text.TextFieldAutoSize; import com.doitflash.text.TextArea; var _textArea:TextArea = new TextArea(); _textArea.condenseWhite = true; _textArea.autoSize = TextFieldAutoSize.LEFT; _textArea.embedFonts = false; _textArea.border = true; _textArea.holder = this; _textArea.client = this; // must be where you have your 'allowed functions' saved _textArea.funcSecurity = true; _textArea.allowedFunctions(myCustomFunction, funcOnOver, funcOnOut); _textArea.mouseRollOverEnabled = true; _textArea.fmlText = "<p>This is a <a href='event:myCustomFunction();onMouseOver:funcOnOver();onMouseOut:funcOnOut()'>link</a>.</p>"; this.addChild(_textArea); function myCustomFunction():void { trace("custome function"); } function funcOnOver():void { trace("rollOver text = " + _textArea.rolledOverText); trace("rollOver url = " + _textArea.rolledOverUrl); } function funcOnOut():void { trace("rollOut"); } |


