Flex Gumbo中如何利用FxAnimateColor类在两种颜色切换过程中加入动画效果的例子

By Minidxer | May 17, 2009

接下来的例子演示了Flex Gumbo中如何利用FxAnimateColor类,在两种颜色切换过程中加入动画效果。

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


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

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <FxApplication name="FxAnimateColor_test"
  3.         xmlns="http://ns.adobe.com/mxml/2009">
  4.  
  5.     <Declarations>
  6.         <FxAnimateColor id="fxAnimateColor"
  7.                 colorFrom="{color1.selectedColor}"
  8.                 colorTo="{color2.selectedColor}"
  9.                 target="{ellipse.fill}" />
  10.     </Declarations>   
  11.  
  12.     <Form>
  13.         <FormItem label="colorFrom:">
  14.             <ColorPicker id="color1"
  15.                     selectedColor="red" />
  16.         </FormItem>
  17.         <FormItem label="colorTo:">
  18.             <ColorPicker id="color2"
  19.                     selectedColor="blue" />
  20.         </FormItem>
  21.         <FormItem>
  22.             <Button id="btn"
  23.                     label="Play"
  24.                     click="fxAnimateColor.play();" />
  25.         </FormItem>
  26.     </Form>
  27.  
  28.     <Ellipse id="ellipse"
  29.             width="300"
  30.             height="200"
  31.             horizontalCenter="0"
  32.             verticalCenter="0">
  33.         <fill>
  34.             <SolidColor />
  35.         </fill>
  36.     </Ellipse>
  37.  
  38. </FxApplication>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: FxAnimateColor, Gumbo | No Comments » | 756 views Tags: , , ,

Search Posts