设置Accordion组件中面板开打时间的几种方法。
openDuration属性。
1:
2:
1:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/05/07/setting-the-open-duration-for-an-accordion-container-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
private function init():void {
slider.value = accordion.getStyle("openDuration");
}
]]>
</mx:Script>
<mx:ApplicationControlBar dock="true">
<mx:Form styleName="plain">
<mx:FormItem label="openDuration:"
direction="horizontal">
<mx:HSlider id="slider"
minimum="0"
maximum="3000"
liveDragging="true"
snapInterval="100"
tickInterval="500"
dataTipPrecision="0" />
<mx:Label text="{slider.value} ms" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:Accordion id="accordion"
openDuration="{slider.value}"
creationPolicy="all"
width="100%"
height="100%"
initialize="init();">
<mx:VBox label="Red"
backgroundColor="red"
width="100%"
height="100%" />
<mx:VBox label="Orange"
backgroundColor="haloOrange"
width="100%"
height="100%" />
<mx:VBox label="Yellow"
backgroundColor="yellow"
width="100%"
height="100%" />
<mx:VBox label="Green"
backgroundColor="haloGreen"
width="100%"
height="100%" />
<mx:VBox label="Blue"
backgroundColor="haloBlue"
width="100%"
height="100%" />
</mx:Accordion>
</mx:Application>
<!-- http://blog.flexexamples.com/2008/05/07/setting-the-open-duration-for-an-accordion-container-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
private function init():void {
slider.value = accordion.getStyle("openDuration");
}
]]>
</mx:Script>
<mx:ApplicationControlBar dock="true">
<mx:Form styleName="plain">
<mx:FormItem label="openDuration:"
direction="horizontal">
<mx:HSlider id="slider"
minimum="0"
maximum="3000"
liveDragging="true"
snapInterval="100"
tickInterval="500"
dataTipPrecision="0" />
<mx:Label text="{slider.value} ms" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:Accordion id="accordion"
openDuration="{slider.value}"
creationPolicy="all"
width="100%"
height="100%"
initialize="init();">
<mx:VBox label="Red"
backgroundColor="red"
width="100%"
height="100%" />
<mx:VBox label="Orange"
backgroundColor="haloOrange"
width="100%"
height="100%" />
<mx:VBox label="Yellow"
backgroundColor="yellow"
width="100%"
height="100%" />
<mx:VBox label="Green"
backgroundColor="haloGreen"
width="100%"
height="100%" />
<mx:VBox label="Blue"
backgroundColor="haloBlue"
width="100%"
height="100%" />
</mx:Accordion>
</mx:Application>
2:
<mx:Style>
Accordion {
openDuration: 800;
}
</mx:Style>
3:Accordion {
openDuration: 800;
}
</mx:Style>
accordion.setStyle("openDuration", 800);