2014-05-15 46 views
0

我是新來flex,我創建一個組合框與itemrenderers包含複選框,我想多個複選框被選中沒有按Ctrl鍵,我搜索了很多鏈接,但他們都給我的CTRL選項只有我期待創建它沒有按Ctrl鍵?我需要一個多選下拉菜單而不按控制鍵?

我的組合框的代碼是

<mx:ComboBox id="cbx" width="200" x="819.2" y="1.5" prompt="--Select Flow--" click="ComboSelection(event)" > 
       <mx:itemRenderer> 
        <mx:Component> 
         <mx:CheckBox label="{data.label}" selected="{data.selected}" click="outerDocument.LoadOrderCh(event)" /> 
        </mx:Component> 
       </mx:itemRenderer> 
       </mx:ComboBox> 

我試圖在查看點擊事件,並停止傳播,但它僅適用於選定的指標,對他人的下拉立即關閉

public function LoadOrderCh(evt:MouseEvent):void 
    { 
     evt.stopPropagation(); 
    } 

回答

0

我有創建多選擇器dropDown的任務。 我創建SkinnableComponent,它的皮膚是

<fx:Metadata> 
<![CDATA[ 
    [HostComponent("ru.vemtek.dynamics.filters.MultipleDropDownList")] 
    ]]> 
</fx:Metadata> 

<s:states> 
    <s:State name="normal"/> 
    <s:State name="open"/> 
    <s:State name="disabled"/> 
</s:states> 

<s:PopUpAnchor id="popUp" displayPopUp.normal="false" displayPopUp.open="true" includeIn="open" 
       left="0" right="0" top="0" bottom="0" itemDestructionPolicy="auto" 
       popUpPosition="below" popUpWidthMatchesAnchorWidth="true"> 
    <s:List id="dropDownList" 
      allowMultipleSelection="true" 
      left="0" right="0" top="0" bottom="0"/> 
</s:PopUpAnchor> 

<s:Button id="openButton" left="0" right="0" top="0" bottom="0" focusEnabled="false" tabEnabled="false" 
      skinClass="ru.vemtek.skins.MultipleDropDownListButtonSkin"/> 

public class MultipleDropDownList extends SkinnableComponent { 
    [SkinPart(required="true")] 
    public var openButton:Button; 

    [SkinPart(required="true")] 
    public var dropDownList:List; 

    private var _dropDownController:DropDownController; 

...

dropDownList.addEventListener(MouseEvent.CLICK, onDropDownListClick); 
... 
private function onDropDownListClick(event:MouseEvent):void { 
     if (!event.ctrlKey && !event.shiftKey) { 
      dropDownController.closeDropDown(false); 
      invalidateSkinState(); 
     } 
    } 

在功能DropDownListClick我可以自定義關閉不關閉名單上的行爲。

也許這個想法對你有幫助。

相關問題