Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 Flex-如果打开警报对话框,下拉列表将被卡住_Actionscript 3_Apache Flex_Flash Builder - Fatal编程技术网

Actionscript 3 Flex-如果打开警报对话框,下拉列表将被卡住

Actionscript 3 Flex-如果打开警报对话框,下拉列表将被卡住,actionscript-3,apache-flex,flash-builder,Actionscript 3,Apache Flex,Flash Builder,在用户从下拉列表中选择某个选项后,我需要显示一个警告对话框 它是flex(flash builder 4.6)中的一个简单下拉列表,用于打开警报对话框。当我这样做时,下拉列表被“卡住”了,这意味着选择选项后,通常下拉列表会重新关闭,但当我显示警报时,它会保持打开状态,您必须再次单击某个选项才能关闭它 下拉列表mxml: <s:DropDownList id="typeEventDropDownList" change="type

在用户从下拉列表中选择某个选项后,我需要显示一个警告对话框

它是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>
我已经尝试过在警报对话框之前和之后使用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

您将关闭列表代码放在哪里?这应该起作用:

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

你可以吃类似的东西

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

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

它对我有效。

您的警报框控件中的“this”是否指下拉列表?或者DropDownList的某个父级?我认为如果您收听的是
关闭
事件而不是
更改
事件,则在显示警报之前,下拉列表将关闭。当然,如果您真的需要知道
selectedIndex
是否已实际更改,您可能需要自己确定。下拉列表显示在标题窗口内的组中。所以我相信这是标题indow.RIAStar,你的解决方案奏效了。我所要做的就是将下拉列表从“change”更改为“close”,然后将我的事件类型更改为DropDownEvent,它就工作了,下拉列表就关闭了,其余的代码都正常工作了。谢谢@斯科茨莱特:其余部分是如何“按原样”工作的?我记得你说过它应该只显示DDL中某个选项的警报警告?
close
事件不会触发每个选项的警告吗?我遇到了同样的问题,但我的警报给出了是/否选择。但如果他们选择“否”,则应保留所选内容。如果我使用
close
,那么此时返回似乎太晚了。
protected function typeEventDropDownList_changeHandler(event:IndexChangeEvent):void
{
callLater(DisplayAlert); 
}

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