Thanks, Tim. I was hoping for something more straightforward (the
PopUpMenuButton.itemClick description says "Dispatched when a user
selects an item from the pop-up menu"; this is exactly what I want--or
rather would be, if it did what is documented), but this will do.

Thanks,
-- 
Maciek Sakrejda
Truviso, Inc.
http://www.truviso.com

-----Original Message-----
From: Tim Hoff <[EMAIL PROTECTED]>
Reply-To: flexcoders@yahoogroups.com
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: PopUpMenuButton.itemClick event
Date: Mon, 13 Oct 2008 20:40:46 -0000

Hi Maciek,

The click event pertains to the popup button itself.  You can use that
to open the menu: 

<mx:PopUpButton id="myPopupButton" 
    creationComplete="initMyPopupButtonMenu() "
    click="{ myPopupButton.open() }"/>

The change event is the one that you use when a menu item is selected:

private function initMyPopupButtonMenu():void 
{
    myMenu = new List(); 
    var myMenuItemRenderer:ClassFactory = new
ClassFactory(myItemRenderer);
    myMenuItemRenderer.properties = { labelField: "myField" };
    myMenu.itemRenderer = myMenuItemRenderer;
    myMenu.dataProvider = myDataProvider;
    myMenu.addEventListener("change", myMenuChangeHandler);
    myPopupButton.popUp = myMenu;
}

-TH

--- In flexcoders@yahoogroups.com, Maciek Sakrejda <[EMAIL PROTECTED]>
wrote:
>
> I've set PopUpMenuButton.openAlways = true and it looks like the
> PopUpMenuButton itemClick event is firing even when I click on the
main
> button (with the first item as the "selected" menu item). Is there any
> way to get around this? Basically, what I would like is to *only* pop
up
> the menu when the user clicks on the button (whether the main button
or
> the "expand menu" arrow). I only want a "click" event when the user
> actually selects something from the menu. I tried testing
currentTarget,
> but apparently it's the PopUpMenuButton itself whether you're clicking
> on the main button or the arrow. Any ideas?
> 
> -- 
> Maciek Sakrejda
> Truviso, Inc.
> http://www.truviso.com
>



 


Reply via email to