0

Is it possible to add a "push button" functionality to Spark's DropDownList? (I.e. you select an item from the list and then click at the "main button" to dispatch an event).

Can this be achieved by creating a custom skin based on the DropDownListSkin and replacing the label there by a button:

<s:Label id="labelDisplay" verticalAlign="middle" maxDisplayedLines="1" 
    mouseEnabled="false" mouseChildren="false"
    left="7" right="30" top="2" bottom="2" width="75" verticalCenter="1" /> 

Any feedback is welcome, I'm not experienced in customizing skins yet.

Or maybe I should

override mx_internal function openButton_buttonDownHandler()

?

Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
  • I'm not grokking what you want to do. The "openButton" ( http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/supportClasses/DropDownListBase.html#SkinPart:openButton ) of a Spark DropDownList already dispatches the open event ( http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/supportClasses/DropDownListBase.html#event:open ). You could easily extend the component to dispatch a different event if you felt that was needed. Is that what you need? The label rests on top of the open button – JeffryHouser Apr 04 '12 at 13:17
  • My current MX PopUpButton has a bug that it opens into wrong driection: http://stackoverflow.com/questions/9978545/how-to-ensure-that-the-popup-always-displays-above-the-popupbutton-with-test-ca So I'm hoping that if I switch to Spark DropDownList it will work ok. However the difference between these 2 components is, that DropDownList doesn't allow users to "push the main button" once an item has been selected from the list. So my question is: how to add this "click" functionality to DropDownList? – Alexander Farber Apr 04 '12 at 13:32
  • You have suggested the "openButton" with the triangle icon, but I'm asking about the "main button" on the left of it. – Alexander Farber Apr 04 '12 at 13:36
  • 1
    In the Spark DropDownList the openButton resides behind the full "anchor". The down arrow is just a shape drawn on top of the button. Look at the DropDownListSkin and DropDownListbuttonSkin code respectively. I guess I don't understand what you mean by "main button" here; nor why it is not clickable after selecting an item. – JeffryHouser Apr 04 '12 at 13:49

0 Answers0