这段代码好像没有错呀,是不是版本问题呀。求指教,开发中要用到,刚开始自学。
<?xml version="1.0" encoding="utf-8"?>
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<s:Panel x="117" y="54" width="305" height="200" title="用户登录" fontSize="20" id="user_login" fontFamily="中易宋体" color="#2A7B9D">
<s:Label x="10" y="21" text="用户名:" fontSize="20"/>
<s:Label x="10" y="56" text="密 码:" fontSize="20"/>
<s:TextInput x="88" y="20" id="userName"/>
<s:TextInput x="88" y="54" id="userPwd"/>
<s:Button x="61" y="108" label="确认" id="login_Y" color="#01080B" click="login()"/>
<s:Button x="184" y="108" label="取消" id="login_N" color="#01080B"/>
</s:Panel>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public function login():void{
if(userName==""||userPwd==""){
Alert.show("用户名和密码不能为空");
}
else if(userName=="lxw"&&userPwd=="123"){
Alert.show("登录成功");
}
}
]]>
</mx:Script>