mxml页面
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.remoting.RemoteObject;
private var obj:RemoteObject = new RemoteObject("sro");
private function say():void{
obj.addEventListener(FaultEvent.FAULT,sayFalut);
obj.addEventListener(ResultEvent.RESULT,success);
obj.sayHello("jarvis");
}
private function sayFalut(event:FaultEvent):void{
Alert.show(event.message.toString(),"调用失败~");
}
private function success(event:ResultEvent):void{
Alert.show(String(event.result),"调用成功");
}
]]>
调用时报的错为:
messageAgents = (Array)#9
[0] (mx.rpc::AsyncRequest)#10
authenticated = false
autoConnect = true
channelSet = (mx.messaging::ChannelSet)#6
clientId = (null)
connected = false
defaultHeaders = (null)
destination = "sro"
id = "83FC0077-947D-2627-CF83-9B527180730B"
reconnectAttempts = 0
reconnectInterval = 0
requestTimeout = -1
subtopic = ""
connected = false
connectTimeout = -1
enableSmallMessages = true
endpoint = "http://127.0.0.1:8080/FlexToJava/messagebroker/amf"
failoverURIs = (Array)#11
id = "my-amf"
mpiEnabled = false
netConnection = (flash.net::NetConnection)#12
client = (mx.messaging.channels::AMFChannel)#4
connected = false
objectEncoding = 3
proxyType = "none"
uri = "http://127.0.0.1:8080/FlexToJava/messagebroker/amf"
piggybackingEnabled = false
polling = false
pollingEnabled = true
pollingInterval = 3000
protocol = "http"
reconnecting = false
recordMessageSizes = false
recordMessageTimes = false
requestTimeout = -1
uri = "http://127.0.0.1:8080/FlexToJava/messagebroker/amf"
但是我通过进行调用是可以的。
2009年7月21日 11:35