其他语言

本类阅读TOP10

·基于Solaris 开发环境的整体构思
·使用AutoMake轻松生成Makefile
·BCB数据库图像保存技术
·GNU中的Makefile
·射频芯片nRF401天线设计的分析
·iframe 的自适应高度
·BCB之Socket通信
·软件企业如何实施CMM
·入门系列--OpenGL最简单的入门
·WIN95中日志钩子(JournalRecord Hook)的使用

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
Flex中有没有blocking?

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

最近在看Flex的groups中发现有一个以前遇到的问题,但是没有意识到的问题。当我在一个函数中发出httpservice,然后加入一个事件的监听处理httpservice返回的值,后面如果还有代码回马上执行,并不会等处理完httpservice返回再进行。是我的代码有问题还是Flex本身就是这样的呢?刚刚看到Group里的一个贴子说在ActionScript中没有真正意义上的Blocking,用Alert,并且配合shoumodel模式来实现阻止用户继续和界面交互。这样对于我刚刚遇到的问题没有什么帮助,可以尝试在处理httpservice返回函数设置返回值,调用函数根据这个返回值进行下一步的操作。

There is no true blocking in ActionScript. Both alerts and modal pop-ups only
stop the user from interacting with the UI. All code continues to execute to
the end.

To do what you want, you need to have a two part approach, where you call the
confirmation dialog first, then, when that is dismissed, take the actual action.

Below is an example using an alert. In my application, is use a modal pop-up
so that I can have more control.

Tracy

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">

<mx:Script><![CDATA[

        private function doAction(sAction:String):Void
        {
                alert(sAction,
                                "Confirm Action",
                                mx.controls.Alert.YES|mx.controls.Alert.NO,
                                handleConfirm,
                                mx.controls.Alert.NO)
        }//        

        private function handleConfirm(oEvent:Object):Void
        {
                switch(oEvent.detail)
                {
                        case 1:
                                alert("The Action was Confirmed")
                                break;
                        case 2:
                                alert("The Action was Canceled")
                                break;
                }//switch()

        }//
]]></mx:Script>

        <mx:Button label="Do Some Action" click="doAction('delete')"/>

</mx:Application>




相关文章

相关软件