java 的undefined_参数和undefined

在MXML的页面中,使用了http返回参数中没有定义的变量,并没有显示报错信息,而是显示了underfined。我用在text的显示和输入界面里了,如果用在tree或者其他的变量可能就报错了。所以还是定义一个函数专门处理返回的参数能够使程序更健壮吧!

近在看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"?>

{

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()

}//]]>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值