flex的条件判断:存在即为true

来源:互联网 发布:windows优化大师功能 编辑:程序博客网 时间:2024/05/07 04:59
<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"><mx:Script><![CDATA[import mx.controls.Alert;private var str:String = null;private var o:Object = "123";private function init():void {//因为str是空所以条件不成立if(str) {Alert.show(str.toString());}//因为o不为空所以条件成立if(o) {Alert.show(o.toString());}}]]></mx:Script></mx:Application>

原创粉丝点击