tags:

views:

228

answers:

2

I have PopUpMenuButton. I want to make it so that a mouseover (over either the button or the "V" part) pops open the menu. I don't care about the button click

I tried to do a My_PopUpMenuButton.dispatchEvent(new MenuEvent(MenuEvent.ITEM_CLICK)) when another button was clicked, but that didn't work.

Any ideas? Thanks!

+1  A: 

Have you tried calling the control's open() method directly on mouseOver, like so?

<mx:PopUpMenuButton id="myButton" mouseOver="myButton.open()" label="Hover Over Me">
    <mx:dataProvider>
     <mx:Array>
      <mx:String>Item One</mx:String>
      <mx:String>Item Two</mx:String>
      <mx:String>Item Three</mx:String>
     </mx:Array>
    </mx:dataProvider>
</mx:PopUpMenuButton>

If I've misunderstood the question, or if there's additional behavior you're trying to suppress, post back and I'll keep an eye out.

Christian Nunciato
Thanks! Exactly what I was looking for.
sri
+1  A: 

There is method open in PopUpButton control:

    <mx:Script>
        <![CDATA[

            ...

            private function onMouseOver(event:MouseEvent):void
            {
                popupButton.open();
            }

            ...
        ]]>
    </mx:Script>

...
    <mx:PopUpButton id="popupButton" label="Test" creationComplete="initMenu();" mouseOver="onMouseOver(event)"/>
...
zdmytriv