AlertNormalButtonSkin.mxml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <s:SparkSkin name="CustomDefaultButtonSkin"
  3. xmlns:fx="http://ns.adobe.com/mxml/2009"
  4. xmlns:s="library://ns.adobe.com/flex/spark"
  5. minWidth="24" minHeight="20"
  6. alpha.disabled="0.5">
  7. <!-- states -->
  8. <s:states>
  9. <s:State name="up" />
  10. <s:State name="over" stateGroups="overStates" />
  11. <s:State name="down" stateGroups="downStates" />
  12. <s:State name="disabled" stateGroups="disabledStates" />
  13. <s:State name="selectedUp" stateGroups="selectedStates, selectedUpStates" />
  14. <s:State name="selectedOver" stateGroups="overStates, selectedStates" />
  15. <s:State name="selectedDown" stateGroups="downStates, selectedStates" />
  16. <s:State name="selectedDisabled" stateGroups="selectedUpStates, disabledStates, selectedStates" />
  17. </s:states>
  18. <fx:Script>
  19. <![CDATA[
  20. [Bindable]
  21. public var cornerRadius:Number = 8;
  22. override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
  23. var cr:Number = getStyle("cornerRadius");
  24. if (cornerRadius != cr) {
  25. cornerRadius = cr;
  26. }
  27. super.updateDisplayList(unscaledWidth, unscaledHeight);
  28. }
  29. ]]>
  30. </fx:Script>
  31. <!-- layer 1: shadow -->
  32. <s:Rect left="-1" right="-1" top="-1" bottom="-1" radiusX="{cornerRadius}">
  33. <s:fill>
  34. <s:LinearGradient rotation="90">
  35. <s:GradientEntry color="0x4fa119"
  36. color.downStates="0x4fa119"
  37. alpha="0.01"
  38. alpha.downStates="0" />
  39. <s:GradientEntry color="0xffffff"
  40. color.downStates="0xffffff"
  41. alpha="0.07"
  42. alpha.downStates="0.5" />
  43. </s:LinearGradient>
  44. </s:fill>
  45. </s:Rect>
  46. <!-- layer 2: fill -->
  47. <s:Rect left="1" right="1" top="1" bottom="1" radiusX="{cornerRadius}">
  48. <s:fill>
  49. <s:LinearGradient rotation="90">
  50. <s:GradientEntry color="#4fa119"
  51. color.selectedUpStates="#3a7811"
  52. color.overStates="#3a7811"
  53. color.downStates="#3a7811"
  54. alpha.selectedOver="1" />
  55. <s:GradientEntry color="0x337b03"
  56. color.selectedUpStates="#337b03"
  57. color.over="#337b03"
  58. color.selectedOver="#337b03"
  59. color.downStates="#337b03"
  60. alpha.selectedOver="1" />
  61. </s:LinearGradient>
  62. </s:fill>
  63. </s:Rect>
  64. <!-- layer 3: fill lowlight -->
  65. <s:Rect left="1" right="1" bottom="1" height="9" radiusX="{cornerRadius}">
  66. <s:fill>
  67. <s:LinearGradient rotation="90">
  68. <s:GradientEntry color="0x4fa119" alpha="0.0099" />
  69. <s:GradientEntry color="0x3a7811" alpha="0.0627" />
  70. </s:LinearGradient>
  71. </s:fill>
  72. </s:Rect>
  73. <!-- layer 4: fill highlight -->
  74. <s:Rect left="1" right="1" top="1" height="9" radiusX="{cornerRadius}">
  75. <s:fill>
  76. <s:SolidColor color="0x3a7811"
  77. alpha="0.32"
  78. alpha.selectedUpStates="0.22"
  79. alpha.overStates="0.22"
  80. alpha.downStates="0.12" />
  81. </s:fill>
  82. </s:Rect>
  83. <!-- layer 5: highlight stroke (all states except down) -->
  84. <s:Rect left="1" right="1" top="1" bottom="1" radiusX="{cornerRadius}" excludeFrom="downStates">
  85. <s:stroke>
  86. <s:LinearGradientStroke rotation="90" weight="1">
  87. <s:GradientEntry color="#3a7811" alpha.overStates="0.22" alpha.selectedUpStates="0.33" />
  88. <s:GradientEntry color="#3a7811" alpha.overStates="0.22" alpha.selectedUpStates="0.33" />
  89. </s:LinearGradientStroke>
  90. </s:stroke>
  91. </s:Rect>
  92. <!-- layer 6: highlight stroke (down state only) -->
  93. <s:Rect left="1" top="1" bottom="1" width="1"
  94. includeIn="downStates, selectedUpStates, selectedOver">
  95. <s:fill>
  96. <s:SolidColor color="0x000000" alpha="0.07" />
  97. </s:fill>
  98. </s:Rect>
  99. <s:Rect right="1" top="1" bottom="1" width="1"
  100. includeIn="downStates, selectedUpStates, selectedOver">
  101. <s:fill>
  102. <s:SolidColor color="0x000000" alpha="0.07" />
  103. </s:fill>
  104. </s:Rect>
  105. <s:Rect left="2" top="1" right="2" height="1"
  106. includeIn="downStates, selectedUpStates, selectedOver">
  107. <s:fill>
  108. <s:SolidColor color="0x000000" alpha="0.25" />
  109. </s:fill>
  110. </s:Rect>
  111. <s:Rect left="1" top="2" right="1" height="1"
  112. includeIn="downStates, selectedUpStates, selectedOver">
  113. <s:fill>
  114. <s:SolidColor color="0x000000" alpha="0.09" />
  115. </s:fill>
  116. </s:Rect>
  117. <!-- layer 7: border - put on top of the fill so it doesn't disappear when scale is less than 1 -->
  118. <s:Rect left="0" right="0" top="0" bottom="0" width="69" height="20" radiusX="{cornerRadius}">
  119. <s:stroke>
  120. <s:LinearGradientStroke rotation="90" weight="1">
  121. <s:GradientEntry color="0x2f5e0f"
  122. alpha="0.5625"
  123. alpha.down="0.6375"
  124. alpha.selectedStates="0.6375" />
  125. <s:GradientEntry color="0x2f5e0f"
  126. alpha="0.75"
  127. alpha.down="0.85"
  128. alpha.selectedStates="0.85" />
  129. </s:LinearGradientStroke>
  130. </s:stroke>
  131. </s:Rect>
  132. </s:SparkSkin>