在网上找的一个 Flex登录界面 借鉴使用一下。PS:已经忘记出处了 抱歉~~~~
<?xml version="1.0" ?> <!-- Simple example to demonstrate the States class. --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Style> Application { fontSize:12pt; } </mx:Style> <mx:Script> <![CDATA[ import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; //数据返回成功的处理,本例中不适用这个方法处理结果,而是直接通过lastresult邦迪给控件 private function onresult(e:ResultEvent):void { trace("onResult"); } private function onFault(e:ResultEvent):void { ta.text="读取数据错误,请稍后再试"; btnSearch.enabled=true; } private function search():void { btnSearch.enabled=false; myws.getMostPopularPosts.send(); } ]]> </mx:Script> <mx:WebService id="myws" wsdl="http://feeds.adobe.com/webservices/mxna2.cfc?wsdl" showBusyCursor="true"> <!--定义WebService的方法--> <mx:operation name="getMostPopularPosts" result="onresult(event)" fault="onFault"> <!--调用方法是传递的参数。tag名称就是参数名称--> <mx:request > <dayBack>10</dayBack> <limit>10</limit> </mx:request> </mx:operation> </mx:WebService> <!--定义WebService--> <mx:Panel > <mx:Button id="btnSearch" label="查看" click="search()" /> <!--DataGrid 显示结果,直接将结果绑定给DataProvider--> <mx:DataGrid id="grdResult" x="97" y="10" dataProvider="{myws.getMostPopularPosts.lastResult}"> <mx:columns> <mx:DataGridColumn headerText="最热主题" dataField="postTitle"/> <mx:DataGridColumn headerText="点击数" dataField="clicks" width="75"/> </mx:columns> </mx:DataGrid> <mx:TextArea id="ta" x="12" y="71" width="500" height="100" editable="false" text="{grdResult.selectedItem.postExcerpt}"/> </mx:Panel> </mx:Application>
转载于:https://blog.51cto.com/100240129/1407513