谁能大致的解释下下面的flex代码?thank you!<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:RemoteObject destination="com.yeeach.HelloWorldService" id="helloWorldService">
<mx:method name="hello" result="sayHelloResult(event)"/>
<mx:method name="world" result="sayWorldResult(event)"/>
</mx:RemoteObject>
<mx:HBox>
<mx:Label text="输入:"/>
<mx:TextInput id="inputStr"/>
<mx:Button label="say hello" click="sayHello(event);"/>
<mx:Button label="say world" click="sayWorld(event);"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="结果:"/>
<mx:TextArea id="result"/>
</mx:HBox>
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
function sayHello(event:Event):void
{
var inputVar:String=inputStr.text;
helloWorldService.hello(inputVar);
}
function sayWorld(event:Event):void
{
var inputVar:String=inputStr.text;
helloWorldService.world(inputVar);
}
private function sayHelloResult(event:ResultEvent):void
{
result.text=event.result.toString();
Alert.show(event.result.toString(), "返回结果");
}
private function sayWorldResult(event:ResultEvent):void
{
result.text=event.result.toString();
Alert.show(event.result.toString(), "返回结果");
}
]]>
</mx:Script>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:RemoteObject destination="com.yeeach.HelloWorldService" id="helloWorldService">
<mx:method name="hello" result="sayHelloResult(event)"/>
<mx:method name="world" result="sayWorldResult(event)"/>
</mx:RemoteObject>
<mx:HBox>
<mx:Label text="输入:"/>
<mx:TextInput id="inputStr"/>
<mx:Button label="say hello" click="sayHello(event);"/>
<mx:Button label="say world" click="sayWorld(event);"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="结果:"/>
<mx:TextArea id="result"/>
</mx:HBox>
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
function sayHello(event:Event):void
{
var inputVar:String=inputStr.text;
helloWorldService.hello(inputVar);
}
function sayWorld(event:Event):void
{
var inputVar:String=inputStr.text;
helloWorldService.world(inputVar);
}
private function sayHelloResult(event:ResultEvent):void
{
result.text=event.result.toString();
Alert.show(event.result.toString(), "返回结果");
}
private function sayWorldResult(event:ResultEvent):void
{
result.text=event.result.toString();
Alert.show(event.result.toString(), "返回结果");
}
]]>
</mx:Script>
</mx:Application>
<mx:method name="world" result="sayWorldResult(event)"/><mx:Button label="say hello" click="sayHello(event);"/>
<mx:Button label="say world" click="sayWorld(event);"/>主要是这四句代码怎么理解
返回结果的方法:sayHelloResult
HelloWorldService.world();
返回结果的方法:sayWorldResult
两个button 点击事件