Shared Know How


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

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

Problem:
TextArea shows a border by default

Solution:
myTextArea.setStyle("upSkin",Sprite);

Description:
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:

myTextArea.setStyle("upSkin",Sprite);

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

FlashTracer in Ubuntu (Hardy) 64-bit

author Posted by: thijs on date Apr 25th, 2008 | filed Filed under: flash

There is this nifty firefox plugin that lets you see the trace messages of Flash files in your browser called FlashTracer made by Sephiroth.

To use this plugin you have to download the flash debugger player.
As you cannot use the provided flashplayer installer in the package, as it collides with the 64-bits architecture, you have to use ndiswrapper to do the job.

After unpacking the archive, find where the libflashplayer.so file is located (probably flash_player_9_linux_dev/plugin/debugger).
Then open-up a terminal and type:

  • nsplugginwrapper -i /full/path/to/libflashplayer.so

(in my case: /home/myname/flash_player_9_linux_dev/plugin/debugger/libflashplayer.so)

After that, hit Alt + A (default shortcut for the flash tracer) or go to Tools -> Flash Tracer to start tracing away!

  • OS: Ubuntu 8.04 (Hardy Heron ) 64-bit
  • Using: Firefox 3 beta 5, Flash debug player 9.0.124 (also works for 9.0.115)