浏览 3203 次
锁定老帖子 主题:FLEX做登入
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-03-03
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()" layout="absolute"> <mx:Style> Application{ fontSize:12; fontfamily: "_sans", Arial; backgroundGradientColors: #AEB4E6, #AEB4E6; } </mx:Style> <mx:Script> <![CDATA[ import mx.controls.Alert; import mx.managers.CursorManager; private var loader:URLLoader; private var myXML:XML; private var rssURL:String="http://localhost/1.xml"; internal function init():void{ loader=new URLLoader(); var request:URLRequest=new URLRequest(rssURL); loader.addEventListener(Event.COMPLETE,success); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,security); loader.addEventListener(IOErrorEvent.IO_ERROR,ioEeroe); loader.load(request); CursorManager.setBusyCursor(); } internal function login():void{ if(name1.text==myXML..username&&pwd1.text==myXML..password){ Alert.show("登入OK","提示"); }else{ Alert.show("登入失败","提示"); } } internal function clear():void{ name1.text=""; pwd1.text=""; } internal function success(evt:Event):void{ CursorManager.removeBusyCursor(); myXML=XML(evt.target.data); } internal function security(evt:SecurityErrorEvent):void{ trace("安全错误"); } internal function ioEeroe(evt:IOErrorEvent):void{ trace("IO错误"); } ]]> </mx:Script> <mx:TextInput id="name1" x="440" y="148"/> <mx:TextInput id="pwd1" x="440" y="192" displayAsPassword="true"/> <mx:Label x="303" y="150" text=" 用户名" width="64"/> <mx:Label x="303" y="194" text=" 密码" width="64"/> <mx:Button x="303" y="283" label=" 登入" click="login()"/> <mx:Button x="475" y="283" label=" 清空" click="clear()"/> </mx:Application> 1.xml <?xml version="1.0" encoding="utf-8"?> <user> <username>admin</username> <password>admin</password> </user> 呵呵学习httpservice时写的 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |