Flex Gumbo中如何设置一个具有放射性角度填充的Rect的x,y轴位置的例子

By Minidxer | June 10, 2009

接下来的例子演示了Flex Gumbo中如何设置一个具有放射性角度填充的Rect的x,y轴位置。

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


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

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Application name="Rect_fill_RadialGradient_x_test"
  3.         xmlns="http://ns.adobe.com/mxml/2009"
  4.         layout="vertical"
  5.         verticalAlign="middle"
  6.         backgroundColor="white">
  7.  
  8.     <ApplicationControlBar dock="true">
  9.         <Form styleName="plain">
  10.             <FormItem label="x:">
  11.                 <HSlider id="sliderX"
  12.                         minimum="-150"
  13.                         maximum="450"
  14.                         value="150"
  15.                         snapInterval="1"
  16.                         tickInterval="50"
  17.                         liveDragging="true" />
  18.             </FormItem>
  19.             <FormItem label="y:">
  20.                 <HSlider id="sliderY"
  21.                         minimum="-100"
  22.                         maximum="300"
  23.                         value="100"
  24.                         snapInterval="1"
  25.                         tickInterval="50"
  26.                         liveDragging="true" />
  27.             </FormItem>
  28.         </Form>
  29.     </ApplicationControlBar>
  30.  
  31.     <Graphic>
  32.         <Rect id="rect" width="300" height="200">
  33.             <fill>
  34.                 <RadialGradient x="{sliderX.value}" y="{sliderY.value}">
  35.                     <entries>
  36.                         <GradientEntry color="red" />
  37.                         <GradientEntry color="white" />
  38.                         <GradientEntry color="blue" />
  39.                     </entries>
  40.                 </RadialGradient>
  41.             </fill>
  42.         </Rect>
  43.     </Graphic>
  44.  
  45. </Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

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

Search Posts