apache-flex Flex -如果打开警报对话框,则下拉列表卡住

gc0ot86w  于 2022-11-01  发布在  Apache
关注(0)|答案(2)|浏览(119)

我需要在用户在下拉列表中选择某个选项后显示一个警告对话框。
这是flex(flash builder 4.6)中一个简单的下拉列表,打开一个警告对话框。当我这样做时,下拉列表被“卡住”了,这意味着在选择后,通常下拉列表会重新关闭,但当我显示一个警告时,它保持打开状态,你必须再次单击一个选项才能关闭它。
下拉列表mxml:

<s:DropDownList id="typeEventDropDownList"
                        change="typeEventDropDownList_changeHandler(event)"
                        selectedIndex="0">
            <s:layout>
                <s:VerticalLayout requestedRowCount="10"/>
            </s:layout>
            <s:dataProvider>
                <s:ArrayList source="[ChooseAction,a,b,c,d,e,f,g,h,i]" />
            </s:dataProvider>
        </s:DropDownList>

下拉列表处理程序:

protected function typeEventDropDownList_changeHandler(event:IndexChangeEvent):void
            {
                     // if this alert is called, the drop down list 'sticks' open.   if the alert is removed, it closes normally
            Alert.show("bla bla bla", "Warning",mx.controls.Alert.OK , this, null);  // does not matter if a method is called from here
                        }

我已经尝试了在警报对话框之前和之后使用closeDropDown(甚至调用OpenDropDown)的几种组合,这似乎没有什么区别:

typeEventDropDownList.openDropDown();  //have tried opening and closing, closing only, before and after alert - no difference
         typeEventDropDownList.closeDropDown(true);  // have tried true and false  no difference
e0bqpujr

e0bqpujr1#

"你可以有"

protected function typeEventDropDownList_changeHandler(event:IndexChangeEvent):void
{
callLater(DisplayAlert); 
}

protected function DisplayAlert()
{
//Display your alert here , i.e., Alert.show()
}

"这对我很有效"

qyswt5oh

qyswt5oh2#

关闭列表代码放在哪里?应该可以:

protected function typeEventDropDownList_changeHandler(event:IndexChangeEvent):void
{
    typeEventDropDownList.closeDropDown(true);
    Alert.show("bla bla bla", "Warning",mx.controls.Alert.OK , this, null);
}

相关问题