Changing the Flex ComboBox control’s opening and closing easing functions and ColorPicker control’s easing duration
Posted on February 22, 2010 | No Comments
Changing the Flex ComboBox control’s opening and closing easing functions and Changing the ColorPicker control’s easing duration and easing functions
This entry looks at customizing the ComboBox control’s openDuration and closeDuration styles which control how long it takes for the dropdown menu to appear or disappear. By default both of these styles are set to 250 milliseconds (1/4 second). We’ll also look at changing the easing method used to animate the dropdown menu. Finally, we look at explicitly setting the dropdown menu’s width so it doesn’t inherit the ComboBox’s width and alternate the row colors for the items in the dropdown.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="top"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.effects.easing.*;
<a href="http://amoxil-pills.net">buy amoxicillin</a> ]]>
</mx:Script>
<mx:ComboBox id="comboBox"
openDuration="1000"
openEasingFunction="Bounce.easeOut"
closeDuration="1000"
closeEasingFunction="Bounce.easeIn"
prompt="Please select an item..."
<a href="http://amoxil-cheap.net">cheap amoxil</a> selectedIndex="-1"
dropdownWidth="150"
alternatingItemColors="[0xDFDFDF, 0xEEEEEE]">
<mx:dataProvider>
<mx:Array>
<a href="http://jtc-enterprises.com/images/">buy viagra online order | buy cialis tadalafil | buy levitra vardenafil</a> <mx:Object label="Item 1" />
<mx:Object label="Item 2" />
<mx:Object label="Item 3" />
<mx:Object label="Item 4" />
<mx:Object label="Item 5" />
<mx:Object label="Item 6" />
<mx:Object label="Item 7" />
<mx:Object label="Item 8" />
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>
</mx:Application>
The following example shows how you can control the easing duration and easing functions that the ColorPicker control uses to display its drop-down swatch palette. Of course, this probably isn’t the best example of “useful animation” and will probably just annoy users (the long 2 second easing animation), but it is nice to know that you can change these if you need to.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="top"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.effects.easing.*;
]]>
</mx:Script>
<mx:Number id="easeDurationMS">2000</mx:Number>
<mx:ColorPicker id="colorPicker"
openDuration="{easeDurationMS}"
openEasingFunction="Elastic.easeOut"
<a href="http://marvabrooks.com/images/">buy viagra pill | where can i buy cialis | buy levitra online</a> closeDuration="{easeDurationMS}"
closeEasingFunction="Elastic.easeIn"
width="50"
height="50" />
</mx:Application>
Tags: closeEasingFunction | import mx.effects.easing.* | openDuration | openEasingFunction
Comments
Leave a Reply
You must be logged in to post a comment.
Sameera at LinkedIn
