Flex Gumbo中如何利用repeat属性重复填充BitmapGraphic对象的例子

By Minidxer | June 5, 2009

接下来的例子演示了Flex Gumbo中如何利用repeat属性,重复填充BitmapGraphic对象。

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


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

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Application name="BitmapGraphic_repeat_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="repeat:">
  11.                 <CheckBox id="checkBox" />
  12.             </FormItem>
  13.             <FormItem label="width:">
  14.                 <HSlider id="widthSlider"
  15.                         minimum="100"
  16.                         maximum="500"
  17.                         value="300"
  18.                         snapInterval="1"
  19.                         tickInterval="50"
  20.                         liveDragging="true" />
  21.             </FormItem>
  22.             <FormItem label="height:">
  23.                 <HSlider id="heightSlider"
  24.                         minimum="100"
  25.                         maximum="300"
  26.                         value="200"
  27.                         snapInterval="1"
  28.                         tickInterval="50"
  29.                         liveDragging="true" />
  30.             </FormItem>
  31.         </Form>
  32.     </ApplicationControlBar>
  33.  
  34.     <Graphic>
  35.         <BitmapGraphic id="bitmapGr"
  36.                 source="@Embed('assets/fx_appicon-tn.gif')"
  37.                 repeat="{checkBox.selected}"
  38.                 width="{widthSlider.value}"
  39.                 height="{heightSlider.value}" />
  40.     </Graphic>
  41.  
  42. </Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

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

Search Posts