Laxmidi
Laxmidi

Reputation: 2684

Flex 3 PopUpMenuButton and ReferenceError #1069

I've got a PopUpMenuButton in a Flex 3 application. If someone clicks on the pulldown part, it works fine. But, if they click on the main button part, I get get ReferenceError: Error #1069. After the user dismisses the error, it then does what it's supposed to do.

<mx:PopUpMenuButton
    id="myPopUpMenuButton2"
    label="Flip"
    labelField="@label"
    dataProvider="{myList2}" 
    itemClick="popUpMenuButtonClickHandler2(event);flipperPhotoSearcher1(event.item.@neigborhoodNum, event.item.@imageSeries);"
    click="defaultpopUpMenuButtonClickHandler2()"
/>


public function popUpMenuButtonClickHandler2(event:MenuEvent):void {
        mainViewStack.selectedChild = this[event.item.@chosen];
        myPopUpMenuButton2.label = event.item.@label;
        neighborhoodPopUpMenuButton.label = "Neighborhoods";
    }  


public function defaultpopUpMenuButtonClickHandler2():void {
        mainViewStack.selectedChild = home;
        myPopUpMenuButton2.label = 'Adams Morgan';
        flipperPhotoSearcher1(2,1);
        neighborhoodPopUpMenuButton.label = "Neighborhoods";
    }   

Any ideas as to what I'm doing wrong?

Thank you.

-Laxmidi

Upvotes: 0

Views: 359

Answers (1)

NorthernPike
NorthernPike

Reputation: 11

In the MXML portion of your code, the click handler must pass an event argument just like the itemClick event handler has.

click="defaultpopUpMenuButtonClickHandler2()"
should be...
click="defaultpopUpMenuButtonClickHandler2(event)"
or, you could do this...
click="defaultpopUpMenuButtonClickHandler2(null)"

but your handler should receive the event as a MouseEvent type, not ItemClick.

public function defaultpopUpMenuButtonClickHandler2():void {
should be...
public function defaultpopUpMenuButtonClickHandler2(event:MouseEvent):void {

weather null is passed or not.

Upvotes: 1

Related Questions