Avocado Blog Zen and the Art of Flash Development

14Apr/110

[Style] must annotate a class

I recently tried to extend Flex UITextField -component to add support for specifying filters through css. I tried to specify custom [Style] metadata information and came across the problem where Flex compiler complains that "[Style] must annotate a class". I still have no clue what it means, but I got rid of the error by adding "use namespace mx_internal" above my custom style definitions so that the beginning of the code looks like this:


package fi.avocado.display
{
import mx.core.UITextField;
import mx.core.mx_internal;

use namespace mx_internal;

/**
* Text outer drop shadow
*/
[Style(name="textOuterShadow", type="String", inherit="yes", defaultValue="none")]

/**
* Text inner drop shadow
*/
[Style(name="textInnerShadow", type="String", inherit="yes", defaultValue="none")]

public class FxUITextField extends UITextField
{
etc...

Just a quick note, hope that it saves someone a few hours of wondering... :)