http://www.macromedia.com/go/wish is OK but I”m forwarding these on to QA when possible right now.

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Bray
Sent: Wednesday, March 01, 2006 2:59 PM
To: [email protected]
Subject: [flexcoders] PopupButton bug

 

I looked around for the proper way to report this but could find it.  The code below is from the PopUpButton livedoc, the only change I made is that I commented out the line that changes the label of the PopupButton instance after a menu item is selected.  Doing this causes the menu to not disappear after selecting an item.  If you run this code, just click the "Put in: Inbox" button, and select one of the menu items.  The menu doesn't hide.  If you uncomment the line that changes the label and reload it, the menu will hide as expected.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" height="600" width="600">

    <mx:Script>
        <![CDATA[

            import mx.controls.*;
            import mx.events.*;

            private var myMenu:Menu;

            // Initialize the Menu control, and specify it as the pop up object
            // of the PopUpButton control.
            private function initMenu():void {
                myMenu = new Menu();
                var dp:Object = [{label: "New Folder"}, {label: "Sent Items"},
                    {label: "Inbox"}];       
                myMenu.dataProvider = dp;
                myMenu.selectedIndex = 0;      
                myMenu.addEventListener("change", changeHandler);
                popB.popUpObject = myMenu;
                popB.label = "Put in: " +
            myMenu.getMenuItemAt(myMenu.selectedIndex).getProperty("label");
            }

            // Define the event listener for the Menu control's change event.
            private function changeHandler(event:MenuEvent):void {
                var label:String = event.menuItem.getProperty("label");       
                popTypeB.text=String("Moved to " + label);
                //BUG!!! if you uncomment this, the menu will hide when you expect it to, otherwise it behaves strangely
                //popB.label = "Put in: " + label;
                popB.closePopUp ();
                myMenu.selectedIndex = event.index;
            }
        ]]>
    </mx:Script>

    <mx:VBox>
        <mx:Label text="Main button mimics the last selected menuItem." />
        <mx:PopUpButton id="popB" label="Edit"
            creationComplete="initMenu();"
            width="135" />

        <mx:Spacer height="50" />
        <mx:TextInput id="popTypeB" />

    </mx:VBox>
</mx:Application>




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to