Flex Gumbo中如何通过skinClass样式给应用添加线性填充背景颜色的例子

By Minidxer | July 27, 2009

接下来的例子演示了Flex Gumbo中如何通过skinClass样式,给应用添加线性填充背景颜色。

让我们先来看一下Demo可以点击这里察看源代码):


下面是完整代码(或点击这里察看):
下面是main.mxml:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <FxApplication name="FxApplication_skinClass_test"
  3.         xmlns="http://ns.adobe.com/mxml/2009"
  4.         backgroundColor="white"
  5.         skinClass="CustomFxApplicationSkin">
  6.  
  7.     <Label text="I'm an FxApplication with a custom skinClass."
  8.             horizontalCenter="0"
  9.             verticalCenter="0" />
  10.  
  11. </FxApplication>

下面是CustomFxApplicationSkin.mxml:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Skin name="CustomFxApplicationSkin"
  3.         xmlns="http://ns.adobe.com/mxml/2009">
  4.     <states>
  5.         <State name="normal" />
  6.         <State name="disabled" />
  7.     </states>
  8.  
  9.     <Metadata>
  10.         [HostComponent("mx.components.FxApplication")]
  11.     </Metadata>
  12.  
  13.     <!-- fill -->
  14.     <Rect id="backgroundRect"
  15.             left="0"
  16.             right="0"
  17.             top="0"
  18.             bottom="0">
  19.         <fill>
  20.             <LinearGradient rotation="90">
  21.                 <GradientEntry color="white" />
  22.                 <GradientEntry color="haloBlue" />
  23.             </LinearGradient>
  24.         </fill>
  25.     </Rect>
  26.  
  27.     <Group id="contentGroup"
  28.             left="0"
  29.             right="0"
  30.             top="0"
  31.             bottom="0" />
  32.  
  33. </Skin>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: Gumbo, Other | No Comments » | Tags: , ,

Search Posts