OK, that doesn't work. What's wrong with my code?

private static var m_staticInitialised:Boolean =
DragSelection.staticConstructor();
private static function staticConstructor():Boolean
{
        if (!StyleManager.getStyleDeclaration("DragSelection"))
        {
                // If there is no CSS definition for DragSelection, 
                // then create one and set the default value.
                var borderColorStyle:CSSStyleDeclaration = new
CSSStyleDeclaration();
                borderColorStyle.setStyle("borderColor", 0x316AC5);
                var borderAlphaStyle:CSSStyleDeclaration = new
CSSStyleDeclaration();
                borderAlphaStyle.setStyle("borderAlpha", 1.0);
                var fillColorStyle:CSSStyleDeclaration = new
CSSStyleDeclaration();
                fillColorStyle.setStyle("fillColor", 0x316AC5);
                var fillAlphaStyle:CSSStyleDeclaration = new
CSSStyleDeclaration();
                fillAlphaStyle.setStyle("fillAlpha", 0.5);
                
                StyleManager.setStyleDeclaration("DragSelection",
borderColorStyle, true);
                StyleManager.setStyleDeclaration("DragSelection",
borderAlphaStyle, true);
                StyleManager.setStyleDeclaration("DragSelection",
fillColorStyle, true);
                StyleManager.setStyleDeclaration("DragSelection",
fillAlphaStyle, true);
        }
                
        return true;
}

The values that come out during updateDisplayList are:
borderColor: 0xb7babc (grey)
borderAlpha: 1
fillColor: 0xffffff (white)
fillAlpha: 0.5

It seems the border and fill colours are being overwritten somewhere
(the parent background is white)!

I checked in styleChanged function, but the "styleProp" value just came
through as null every time!

Thanks,

Mark

 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Mark Ingram
Sent: 01 June 2007 11:31
To: [email protected]
Subject: RE: [flexcoders] Best way to set styles in actionscript?

Thanks -
http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhel
p.htm?context=LiveDocs_Book_Parts&file=skinstyle_149_7.html - was the
link I needed!


Mark
 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Muzak
Sent: 01 June 2007 11:10
To: [email protected]
Subject: Re: [flexcoders] Best way to set styles in actionscript?

http://livedocs.adobe.com/flex/2/docs/00001747.html
http://livedocs.adobe.com/flex/2/docs/00001748.html
http://livedocs.adobe.com/flex/2/docs/00001752.html
http://livedocs.adobe.com/flex/2/docs/00001753.html

http://livedocs.adobe.com/flex/2/docs/00001661.html



----- Original Message ----- 
From: "Mark Ingram" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, June 01, 2007 11:58 AM
Subject: [flexcoders] Best way to set styles in actionscript?


Hi, I have a custom component that I want to define styles for. What is
the best way of setting up styles? I understand that if a style has been
set, getStyle never returns undefined? So, should I have something like:

Any help much appreciated!



Mark











--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



Reply via email to