Flex Gumbo中如何通过selectedIndex属性设置FxButtonBar选中索引的例子

By Minidxer | July 12, 2009

接下来的例子演示了Flex Gumbo中如何通过selectedIndex属性,设置FxButtonBar选中索引。

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


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

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Application name="FxButtonBar_selectedIndex_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="requiresSelection:">
  11.                 <FxCheckBox id="checkBox" />
  12.             </FormItem>
  13.             <FormItem label="selectedIndex:"
  14.                     direction="horizontal">
  15.                 <FxHSlider id="slider"
  16.                         minimum="-1"
  17.                         maximum="5"
  18.                         liveDragging="true" />
  19.                 <Label text="{btnBar.selectedIndex}" />
  20.             </FormItem>
  21.         </Form>
  22.     </ApplicationControlBar>
  23.  
  24.     <FxButtonBar id="btnBar"
  25.             selectedIndex="@{slider.value}"
  26.             requiresSelection="{checkBox.selected}">
  27.         <dataProvider>
  28.             <ArrayCollection source="[One,Two,Three,Four,Five,Six]" />
  29.         </dataProvider>
  30.     </FxButtonBar>
  31.  
  32. </Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: FxButtonBar, Gumbo | 1 Comment » | Tags: , ,

Search Posts