Shared Know How

Howto: fix, find, use, make & do it guide

Archive for July, 2008

Fixed AS3 Flash TextArea – CSS incompatibility

author Posted by: wytze on date Jul 8th, 2008 | filed 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:

Error: Error #2009: This method cannot be used on a text field with a style sheet.
at flash.text::TextField/setTextFormat()
at fl.controls::TextArea/drawTextFormat()
at fl.controls::TextArea/draw()
at fl.core::UIComponent/callLaterDispatcher()

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 »

Hiding TextArea border in AS3

author Posted by: thijs on date Jul 8th, 2008 | filed Filed under: flash

TextArea shows a border by default


Using a TextArea in actionscript 3 could come in handy as the Flash component adds in a ScrollBar by default. But it also provides some things you might not want there..

One of those things is the border, that is placed there by default.

Inspired by the solution posted here I found that you can override the skin that is used by default in the component ("upSkin") by using:


by overriding it with a Sprite, which is empty by default, all the visual aspects are cleared... including the border!