I tried the example Application you posted and it worked fine for me (the Alert only came up once each time I changed the selection). Maybe this was a bug that got fixed in 2.0.1? Did you upgrade to version 2.0.1?
Doug On 3/13/07, scott_flex <[EMAIL PROTECTED]> wrote:
I've had the same problem, would also like to know the issue. I ended up using a different control, for UI reasons and I didn't have time to figure out the double event fire. --- In [email protected] <flexcoders%40yahoogroups.com>, "garylee0709" <[EMAIL PROTECTED]> wrote: > > try the following program in flex 2(they come from flex help > documentation,): > > <?xml version="1.0"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> > > <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.addEventListener("itemClick", changeHandler); > popB.popUp = myMenu; > } > > // Define the event listener for the Menu control's > change event. > private function changeHandler(event:MenuEvent):void { > var label:String = event.label; > popTypeB.text=String("Moved to " + label); > popB.label = "Put in: " + label; > popB.close(); > Alert.show('y'); > } > ]]> > </mx:Script> > > <mx:VBox> > <mx:Label text="Main button mimics the last selected > menuItem." /> > <mx:PopUpButton id="popB" label="Edit" > width="135" creationComplete="initMenu();"/> > > <mx:Spacer height="50"/> > <mx:TextInput id="popTypeB"/> > > </mx:VBox> > </mx:Application> > > the problem is in the changeHandler menuEvent handler function,after > items in popupButton was clicked,changeHandler event function always > execute twice.so everytime i click just 1 time,i got 2 Alert of 'y'!! > PS:there were some time that it did act normal,eg:u click the first > item of popupButton,but after that the "twice" effect comes again... > tks for ur time and any replyment will be greatly appreciated. >

