Setting a fade transition on a Spark DropDownList component in Flex Gumbo

The following example shows how you can fade in a Spark DropDownList pop up menu in Flex Gumbo by creating a custom DropDownList skin and setting the transitions property to a transition Fade effect.

Full code after the jump.

To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see “Using the beta Gumbo SDK in Flex Builder 3”.


<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<s:Application name="Spark_DropDownList_transitions_test"

        <s:ArrayList id="arrList"
                source="[Red,Orange,Yellow,Green,Blue]" />

    <s:DropDownList id="dropDownList"
            top="20" />


The custom Spark DropDownList skin, CustomDropDownListSkin.mxml, is as follows:

View skins/CustomDropDownListSkin.mxml

<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<s:SparkSkin name="CustomDropDownListSkin"
        <s:State name="normal" />
        <s:State name="open" />
        <s:State name="disabled" />
        <s:Transition fromState="normal" toState="open">
            <s:Fade target="{popup}" duration="3000" />

    <!-- host component -->

    <!--- Defines the appearance of the DropDownList component's drop down area. -->
    <s:PopUp id="popup"
            left="0" right="0" top="0" bottom="0"
  "true" visible.normal="false"
        <s:Group id="dropDown"
                maxHeight="134" minHeight="22"
      "true" visible.normal="false">
            <!-- border -->
            <s:Rect left="0" right="0" top="0" bottom="0">
                    <s:SolidColorStroke color="0x686868" weight="1"/>

            <!--- fill --->
            <s:Rect id="background" left="1" right="1" top="1" bottom="1" >
                    <s:SolidColor id="bgFill" color="0xFFFFFF" />

            <s:Scroller left="1" top="1" right="1" bottom="1" >
                <s:DataGroup id="dataGroup" itemRenderer="spark.skins.default.DefaultItemRenderer">
                        <s:VerticalLayout gap="0" horizontalAlign="contentJustify"/>

                <s:DropShadowFilter blurX="20" blurY="20" distance="5" angle="90" alpha="0.6" />

    <s:Button id="button" left="0" right="0" top="0" bottom="0" focusEnabled="false"
        skinClass="spark.skins.default.DropDownListButtonSkin" />
    <s:SimpleText id="labelElement" verticalAlign="middle"
        left="7" right="30" top="2" bottom="2" verticalCenter="1" />


View source is enabled in the following example.

This entry is based on a beta version of the Flex Gumbo SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex Gumbo SDK.

7 thoughts on “Setting a fade transition on a Spark DropDownList component in Flex Gumbo

  1. Nice , how about a ‘sliding’ effect , so the ‘PopUp’ ‘slides’ in from the bottom of the button ?

  2. <s:transitions>
    <s:Transition fromState=”normal” toState=”open”>
    <s:Wipe target=”{popUp.popUp}” duration=”200″ direction=”down” />
    <s:Transition fromState=”open” toState=”normal”>
    <s:Wipe target=”{popUp.popUp}” duration=”200″ direction=”up” />

    <s:PopUpAnchor id=”popUp” left=”0″ right=”0″ top=”0″ bottom=”0″
    popUpPosition=”below” popUpWidthMatchesAnchorWidth=”true” includeIn=”open”

  3. I added only this piece of code in the custom skin:

    But it works only for the first time! Rest of the times, it behaves normally with no effects. Any idea what else needs to be done? If I use only “popUp” as target, no effects are working.

  4. Deepak–In order to get the transition to fire more than once, you need to change the destruction policy on the PopupAnchor (itemDestructionPolicy=”never”):

    The PopUpAnchor control that opens the drop-down list.

    In a custom skin class that uses transitions, set the
    itemDestructionPolicy property to never.

Comments are closed.