Recently I had to create an irc chat for flex (Created with as3irclib). Everything worked pretty well, except of these damn stylesheets for textfields.
This is my textarea with a stylesheet, which interprets tags.

Now clicking into the textarea – e.g. drag the slider or the select something… nothing is changing.

After inserting the next message, the font has broken down. Damn stylesheets.
Now here’s the workaround: …
I created a subclass of the textarea and overrode the focus handlers. God bless object orientated programming.
import flash.events.FocusEvent; import flash.text.StyleSheet; import mx.controls.TextArea; public class StyleTextArea extends TextArea { public function StyleTextArea() { super(); } override protected function focusInHandler(event:FocusEvent) : void { // do nothing } override protected function focusOutHandler(event:FocusEvent) : void { // reset the style var ss:StyleSheet = this.styleSheet; this.styleSheet = null; this.styleSheet = ss; } }
Everything I did, was, to null the styleSheet property and set it again after the focus was lost. Then everything worked well. Maybe it is not the best solution for this problem, but internet research didn’t got me a better one.
Hi there,
I was wondering if you are willing to share the source of your flex irc client?
There is already a more well-engineered version, i think.
Check this out: http://code.google.com/p/flexircclient/