Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?xml version="1.0" encoding="utf-8"?>
<degrafa:GraphicRectangularBorderSkin xmlns:mx="http://www.adobe.com/2006/mxml"  xmlns:degrafa="http://www.degrafa.com/2007" xmlns:utils="info.joshmcdonald.barra.utils.*">

    <mx:Script>
        <![CDATA[
            import mx.states.SetStyle;
            import mx.core.UIComponent;

            //--------------------------------------------------------------------------
            //
            //  State
            //
            //--------------------------------------------------------------------------

            [Bindable]
            private var state_disabled : Boolean = false;

            [Bindable]
            private var state_over : Boolean = false;

            [Bindable]
            private var state_down : Boolean = false;

            //--------------------------------------------------------------------------
            //
            //  Impl
            //
            //--------------------------------------------------------------------------

            override public function styleChanged(styleProp : String) : void
            {
                super.styleChanged(styleProp);
                styleProxy.handleStyleChange(styleProp);
            }

            override public function set name(value : String) : void
            {
                super.name = value;
                var comp : String = name ? name.toLowerCase() : "";

                state_disabled = comp.indexOf("disabled") >= 0;
                state_over = comp.indexOf("overskin") >= 0;
                state_down = comp.indexOf("downskin") >= 0;

                if (state_disabled)
                {
                    filters = [new ColorMatrixFilter([0.3,0.3,0.3,0,-32,
                                                      0.3,0.3,0.3,0,-32,
                                                      0.3,0.3,0.3,0,-32,
                                                      0,0,0,1,-64]),
                               new BlurFilter()];
                }
                else if (state_down)
                {
                    filters = [new ColorMatrixFilter([1,0,0,0,16,
                                                      0,1,0,0,16,
                                                      0,0,1,0,16,
                                                      0,0,0,1,0]),
                               new GlowFilter(0xffffff, 0.6, 4, 4, 1.5,1,true),
                               new GlowFilter(0,0.8,3,3,2,1)];
                }
                else if (state_over)
                {
                    filters = [new GlowFilter(0xffffff, 0.6, 4, 4, 1.5,1,true),
                               new GlowFilter(0,1,3,3,2,1)];
                }
                else
                {
                    filters = [new GlowFilter(0,0.6,2,2,1,1)];
                }
            }

        ]]>
    </mx:Script>

    <utils:StyleProxy id="styleProxy"/>

    <degrafa:geometry>

        <degrafa:RoundedRectangle x="0" y="0" width="{skinWidth}" height="{skinHeight}" cornerRadius="3">
            <degrafa:fill>
                <degrafa:SolidFill color="{styleProxy.themeColor}"/>
            </degrafa:fill>
        </degrafa:RoundedRectangle>

        <degrafa:RoundedRectangle x="0" y="0" width="{skinWidth}" height="{skinHeight}" cornerRadius="3">
            <degrafa:fill>
                <degrafa:LinearGradientFill angle="90" blendMode="{BlendMode.SCREEN}">
                    <degrafa:GradientStop ratio="0" color="#ffffff" alpha="0.3"/>
                    <degrafa:GradientStop ratio="0.4" color="#ffffff" alpha="0"/>
                    <!--<degrafa:GradientStop ratio="0.6" color="0" alpha="0"/>
                    <degrafa:GradientStop ratio="1" color="0" alpha="0.3"/>-->
                </degrafa:LinearGradientFill>
            </degrafa:fill>
        </degrafa:RoundedRectangle>

        <degrafa:RoundedRectangle x="0" y="0" width="{skinWidth}" height="{skinHeight}" cornerRadius="3">
            <degrafa:stroke>
                <degrafa:LinearGradientStroke angle="90">
                    <degrafa:GradientStop ratio="0" color="#ffffff" alpha="0.5"/>
                    <degrafa:GradientStop ratio="0.6" color="#ffffff" alpha="0"/>
                </degrafa:LinearGradientStroke>
            </degrafa:stroke>
        </degrafa:RoundedRectangle>

    </degrafa:geometry>

</degrafa:GraphicRectangularBorderSkin>