4 Replies Latest reply on Mar 13, 2012 9:57 PM by RajasekharAbhrapudi

    Can anyone help a way in providing delay while closing of submenu




      I need urgent help with flex flyout menus , please help me out


      I have , for ex-  say 4 parent menus , for each parent menu , I have 5 popup submenus


      When I keep mouse on parent 1 , it opens a submenu with 5 submenu items , when I bring my cursor vertically down and after reaching 2 or 3 submenu items down, and move the mouse back to left where parent menu 2 is there,  parent1’s submenu is immediately closing


      Can any one help me out, if we can increase the delay in closing the submenu , so that when I move my mouse back to any other parent menu ,previous parents  submenu should not close immediately , i mean it should close after soem delay say after 5-6 seconds .


      I have tried with setStyle(“openDuration”,5000);


      I kept it before menu.hide() , It did not worked out and it is only making delay in just opening the submenu, but not making delay in closing the same submenu while keeping my mouse on another parent menu .


      Any help is greatly appreciated


      Thanks in Advance




        • 2. Re: Can anyone help a way in providing delay while closing of submenu
          RajasekharAbhrapudi Level 1



          I have tried it in below way


          Actually i need to provide delay for closing of submenus for a ParentMenu1, when i kept my move my mouse back to ParentMenu2


          So i used callLater method before show() is called on Menu class.


          callLater(myMenu.show(10,10));  where myMenu is my custommenu class object that extends Menu class , used for adding submenus and used for calling show and hide methods of Menu class


          But above is showing compilation errors .


          Please let me know if there is any way of using it correctly or any other method that can provides it


          Thanks in advance




          • 3. Re: Can anyone help a way in providing delay while closing of submenu
            jfb00 Level 3

            Please read the article and see the examples.

            Try to create a test code so anyone can see the issue and maybe help.


            • 4. Re: Can anyone help a way in providing delay while closing of submenu
              RajasekharAbhrapudi Level 1

              Hi I have used the below example from the url




              <?xml version="1.0"?>

              <!-- menus/EventListener.mxml -->

              <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"





                          import mx.controls.Menu;

                          import mx.events.MenuEvent;


                          // Function to create and show a menu.

                          private function createAndShow():void {

                              var myMenu:Menu = Menu.createMenu(null, myMenuData, false);


                              // Add an event listener for the itemClick event.



                              // Show the menu.


                              myMenu.show(225, 10);



                          // The event listener for the itemClick event.

                          private function itemClickInfo(event:MenuEvent):void {

                              ta1.text="event.type: " + event.type;

                              ta1.text+="\nevent.index: " + event.index;

                              ta1.text+="\nItem label: " + event.item.@label

                              ta1.text+="\nItem selected: " + event.item.@toggled;

                              ta1.text+= "\nItem type: " + event.item.@type;





                  <!-- The XML-based menu data provider. -->

                  <mx:XML id="myMenuData">


                          <menuitem label="MenuItem A" >

                              <menuitem label="SubMenuItem A-1" enabled="false"/>

                              <menuitem label="SubMenuItem A-2"/>

                              <menuitem label="SubMenuItem A-3"/>

                              <menuitem label="SubMenuItem A-4"/>

                              <menuitem label="SubMenuItem A-5"/>


                          <menuitem label="MenuItem B" type="check" toggled="true"/>

                          <menuitem label="MenuItem C" type="check" toggled="false"/>

                          <menuitem type="separator"/>    

                          <menuitem label="MenuItem D" >

                              <menuitem label="SubMenuItem D-1" type="radio"


                              <menuitem label="SubMenuItem D-2" type="radio"

                                  groupName="one" toggled="true"/>

                              <menuitem label="SubMenuItem D-3" type="radio"






                  <!-- Button controls to open the menus. -->

                  <mx:Button x="10" y="5"

                      label="Open Menu"


                  <!-- Text area to display the event information -->

                  <mx:TextArea x="10" y="40"

                      width="200" height="100"





              In the above example, when keep mouse on the MenuItemA , submenus will open, then we rollover mouse till submenuItem A-5 , then we we move mouse back to MenuItem2, then submenus of MenuItem-A getting closed immediately, i need some delay like 2-3 seconds before closing the submenus of menuItem-A .


              I used the callLater function as callLater(myMenu.hide());


              but it is giving compilation error


              May I know if the above thing can be achieved by using callLater() function .



              Thanks and Regards