Flex中如何通过openDuration和openEasingFunction样式设置树Tree项目展开与关闭时间长短的例子

By Minidxer | December 22, 2008

接下来的例子演示了Flex中如何通过openDuration和openEasingFunction样式,设置树Tree项目展开与关闭时间长短。

让我们先来看一下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:Script>
  8.         <![CDATA[
  9.             import mx.effects.easing.*;
  10.         ]]>
  11.     </mx:Script>
  12.  
  13.     <mx:XMLListCollection id="xmlListColl">
  14.         <mx:source>
  15.             <mx:XMLList>
  16.                 <node label="One">
  17.                     <node label="One.1" />
  18.                     <node label="One.2" />
  19.                     <node label="One.3" />
  20.                 </node>
  21.                 <node label="Two">
  22.                     <node label="Two.1" />
  23.                     <node label="Two.2" />
  24.                     <node label="Two.3" />
  25.                 </node>
  26.             </mx:XMLList>
  27.         </mx:source>
  28.     </mx:XMLListCollection>
  29.  
  30.     <mx:Tree id="tree"
  31.             dataProvider="{xmlListColl}"
  32.             labelField="@label"
  33.             selectionColor="haloBlue"
  34.             textSelectedColor="white"
  35.             openDuration="3000"
  36.             openEasingFunction="Bounce.easeOut"
  37.             fontSize="24"
  38.             fontWeight="bold"
  39.             rowHeight="40"
  40.             rowCount="4"
  41.             width="300" />
  42.  
  43. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: Tree | No Comments » | 271 views Tags: , ,

Search Posts