1 Reply Latest reply on Jan 8, 2011 11:30 PM by Flex harUI

    Rollout function problem

    MiMeeLunLa

      I'm making a drop down list and use rollover(opendropdown()) to open it but I can't use rollout(closedropdown()) to close it because it will close the list too soon.

      When it open I can't move my mouse down to select the items on the list(if my mouse doesn't rollover on the list BASE it will close)

      like this : http://http://www.shopsthai.com/ddl the right one (credit from:http://www.thaiflashdev.com)

       

      Is any body know how to fix this?


      Here's the code

      <?xml version="1.0" encoding="utf-8"?>
      <!--created:Aug 26, 2010 file:DropDownListDemo2.mxml  author:Michael -->
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"              
                 xmlns:s="library://ns.adobe.com/flex/spark"              
                 xmlns:mx="library://ns.adobe.com/flex/mx" viewSourceURL="srcview/index.html" width="1016" height="743" xmlns:ns1="*">
                       
            <fx:Style>        
               @namespace s "library://ns.adobe.com/flex/spark";        
               s|DropDownList #labelDisplay        
               {   font-weight:bold;           
                  color:#45497c;           
                  font-style:italic;          
               } 
              
            </fx:Style> 
         <fx:Script>       
            <![CDATA[ 
        
               import mx.collections.ArrayList;
               import mx.events.FlexEvent;            
               [Bindable]           
               private var dropListDb:ArrayList;
              
               protected function dl_creationCompleteHandler(event:FlexEvent):void           
               {                
                  dropListDb=new ArrayList();
                  dropListDb.addItem({label: "Bachelor"});
                  dropListDb.addItem({label: "Master"});                
                  dropListDb.addItem({label: "Doctor"}); 
                  this.dl.prompt="Degree";
                       
                  //this.dl.openDropDown(); 
                  //creationComplete="dl_creationCompleteHandler(event)"
               }      
           
              ]]>

         </fx:Script>    

        
         <mx:Image source="C:\Users\Beaut\Desktop\newbgresize.jpg" x="0" y="0" height="589" width="1024"/>
         <s:DropDownList id="dl"

       

                     rollOver="dl.openDropDown()"
                       
                     dataProvider="{dropListDb}"                 
                     alternatingItemColors="[0x88c3f0,0xbbdef9]"                 
                     width="131" skinClass="MyDropDownListSkin"                   
                     itemRenderer="MyDropDownListItemRenerer"                   
                     chromeColor="0x62b6f7"  x="50" y="146" height="22"
                     creationComplete="dl_creationCompleteHandler(event)"
                   
                        
      </s:Application>

      Thank you