Flex Gumbo中如何利用scaleMode属性创建比例尺模式(scale mode)Ellipse对象的例子

By Minidxer | June 20, 2009

接下来的例子演示了Flex Gumbo中如何利用在scaleMode属性上设置LineScaleMode类,创建比例尺模式(scale mode)Ellipse对象。

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


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

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Application name="Ellipse_stroke_scaleMode_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="scaleMode:">
  11.                 <ComboBox id="comboBox" selectedIndex="1">
  12.                     <dataProvider>
  13.                         <Array>
  14.                             <String>{LineScaleMode.NONE}</String>
  15.                             <String>{LineScaleMode.NORMAL}</String>
  16.                             <String>{LineScaleMode.HORIZONTAL}</String>
  17.                             <String>{LineScaleMode.VERTICAL}</String>
  18.                         </Array>
  19.                     </dataProvider>
  20.                 </ComboBox>
  21.             </FormItem>
  22.             <FormItem label="scaleX:">
  23.                 <HSlider id="xSlider"
  24.                         minimum="1"
  25.                         maximum="5"
  26.                         value="1"
  27.                         tickInterval="1"
  28.                         liveDragging="true" />
  29.             </FormItem>
  30.             <FormItem label="scaleY:">
  31.                 <HSlider id="ySlider"
  32.                         minimum="1"
  33.                         maximum="5"
  34.                         value="1"
  35.                         tickInterval="1"
  36.                         liveDragging="true" />
  37.             </FormItem>
  38.         </Form>
  39.     </ApplicationControlBar>
  40.  
  41.     <Graphic>
  42.         <Ellipse id="ellipse"
  43.                 width="80"
  44.                 height="60"
  45.                 scaleX="{xSlider.value}"
  46.                 scaleY="{ySlider.value}">
  47.             <stroke>
  48.                 <SolidColorStroke id="lineStroke"
  49.                         scaleMode="{comboBox.selectedItem}"
  50.                         weight="10" />
  51.             </stroke>
  52.         </Ellipse>
  53.     </Graphic>
  54.  
  55. </Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

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

Search Posts