Fixed AS3 Flash TextArea – CSS incompatibility
Posted by: wytze on
Jul 8th, 2008 |
Filed under: flash
When working with flash components we often run into disadvantages. As with the TextArea class (fl.controls.TextArea) we encountered that it is not possible to use a CSS on its 'textField' property. Once again we thought to have the fast way to an end with components, but nothing of the sort.:'(
Since the 'styleSheet' property returns a standard TextField instance it struck us as weird that setting its 'styleSheet' property didn't work. The TextArea class was trying to set textFormat which fails after setting the stylesheet of the textfield.
Error message:
This pointed us to the 'drawTextFormat()' function in the TextArea class. After taking a look we figured out what to do.
The problem turned out to be that every time you add text to your textarea the class tries to add a designated, or default flash-textFormat to the textfield. Adding Flash TextFormat objects to textfields conflicts with stylesheets. Our solutions was relatively simple: a small class extends of the textArea class.
Click continue for the fixing source
Read more »
Comments (31)
Tags: 