HTMLStyle
by Ruben
This is a component I developed for the sake of simplifying the process of formatting html-text in Flex.
Check it out:
Demo
Source
Documentation
HTMLStyle works pretty much the same as the
<local:HMTLStyle id="myHTMLStyle"> <![CDATA[ .someStyleClass { color: #FF0000; } ]]> </local:HMTLStyle> <mx:TextArea styleSheet="{myHTMLStyle.styleSheet}" />
The component also has a source property which can be set to target an external css file..
If you have any ideas or feedback please drop a comment, I'm very curious as to what you all have to say..
Comments (read newer or show 9 trackbacks)
Trackbacks:
Hi Ruben,
Nice component! Should be very handy in texteditors in a CMS!
I tried the demo, and found a bug! If you add an element like an Unorderd List (ul) it’s been applied to all text. Then, when you remove the UL from the editor, the remaining text still got a nice little bullet.
Ewout
Thanks for the feedback. However I think that the UL-issue lies with Flex its html-handling skills. In the demo the user inputted text is merely copied to the two other textfields, without any additional actions..
It’s kind of hard to explain, but if you really want to find out about it you can have a look at the demo source
Don’t know why, but the download source doesn’t work.
The dubug message:
Error: Error #2009: This method cannot be used on a text field with a style sheet.
at flash.text::TextField/setTextFormat()
at mx.core::UITextField/validateNow()[C:\dev\GMC\sdk\frameworks\mx\core\UITextField.as:1432]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher2()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:7789]
at mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:7732]
Hey Kirill, could it be that you are attempting to apply TextFormat to text that also gets its style from the HTMLStyle tag?
The HTMLStyle component stores its style declarations in StyleSheet objects, and text in Flex (and Flash too) can only get styles from either StyleSheets or TextFormat, not both at the same time..
Well, i have downlaod your source demo, and opened it in Flex. I didn’t change anything.