Flex中如何给ButtonBar添加一个ViewStack的例子

By Minidxer | February 19, 2009

接下来的例子演示了Flex中如何给ButtonBar添加一个ViewStack。

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


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

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  3.         layout="vertical"
  4.         verticalAlign="middle"
  5.         backgroundColor="white">
  6.  
  7.     <mx:ButtonBar id="buttonBar"
  8.             dataProvider="{viewStack}"
  9.             buttonHeight="32" />
  10.  
  11.     <mx:ViewStack id="viewStack">
  12.         <mx:VBox label="Button"
  13.                 icon="@Embed('assets/Button.png')"
  14.                 backgroundColor="white"
  15.                 width="480"
  16.                 height="60">
  17.             <mx:Label text="Button..." />
  18.         </mx:VBox>
  19.         <mx:VBox label="ButtonBar"
  20.                 icon="@Embed('assets/ButtonBar.png')"
  21.                 backgroundColor="white"
  22.                 width="480"
  23.                 height="60">
  24.             <mx:Label text="ButtonBar..." />
  25.         </mx:VBox>
  26.         <mx:VBox label="CheckBox"
  27.                 icon="@Embed('assets/CheckBox.png')"
  28.                 backgroundColor="white"
  29.                 width="480"
  30.                 height="60">
  31.             <mx:Label text="CheckBox..." />
  32.         </mx:VBox>
  33.         <mx:VBox label="ColorPicker"
  34.             icon="@Embed('assets/ColorPicker.png')"
  35.                 backgroundColor="white"
  36.                 width="480"
  37.                 height="60">
  38.             <mx:Label text="ColorPicker..." />
  39.         </mx:VBox>
  40.     </mx:ViewStack>
  41.  
  42. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: ButtonBar | No Comments » | 3,464 views Tags: , ,

Search Posts