Flex 3 PopUpMenuButton和ReferenceError#1069

时间:2010-09-23 21:16:10

标签: flex popupmenubutton

我在Flex 3应用程序中有一个PopUpMenuButton。如果有人点击下拉部分,它可以正常工作。但是,如果他们点击主按钮部分,我会得到 获取ReferenceError:错误#1069。在用户解除错误后,它会执行它应该执行的操作。

<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";
    }   

关于我做错了什么的任何想法?

谢谢。

-Laxmidi

1 个答案:

答案 0 :(得分:1)

在代码的MXML部分中,单击处理程序必须传递一个事件参数,就像itemClick事件处理程序一样。

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

但您的处理程序应该以MouseEvent类型接收事件,而不是ItemClick。

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

天气null是否通过。