Flex CSSStyleDeclaration validation issues

When you define custom styles in Flex, the documentation suggest that you use the following construct:


private static function classConstruct():Boolean {
    if (!StyleManager.getStyleDeclaration("StyledRectangle"))
        // If there is no CSS definition for StyledRectangle, 
        // then create one and set the default value.
        var myRectStyles:CSSStyleDeclaration = new CSSStyleDeclaration();
        myRectStyles.defaultFactory = function():void
          this.fillColors = [0xFF0000, 0x0000FF];
          this.alphas = [0.5, 0.5];
        StyleManager.setStyleDeclaration("StyledRectangle", myRectStyles, true);
    return true;

However, the validator or error checking that is getting executed in the 10781 Build of EAP 9 is showing this as an error.  In the above code snippet, it will highlight 'fillColor' and 'alphas', saying that they are 'Unresolved variables'.  My guess is the validator/error checker is thinking that fillColor and alphas are properties of the ActionScript class containing this method.  But it is really a dynamically defined function that is not getting validated properly.  This type of code is used commonly when creating custom styles (per the section "Defining a Style Property" in the flex documentation.  Is this bug already known and is there a plan to fix it?

1 comment
Comment actions Permalink

Seems to be a bug, please file issue in YouTrack just for not being lost in forum


Please sign in to leave a comment.