flex as3 事件问题
package{importflash.display.Sprite;importflash.events.Event;importmx.controls.Alert;i...
package
{
import flash.display.Sprite;
import flash.events.Event;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.soap.LoadEvent;
import mx.rpc.soap.Operation;
import mx.rpc.soap.WebService;
import flash.events.IEventDispatcher;
public class WSclass
{
public var ws:WebService=new WebService();
public var MethodName:String;
public var returning:String=new String();
public function WSclass(wsdl:String,methodname:String)
{
MethodName = methodname;
ws.addEventListener(LoadEvent.LOAD,load);
ws.loadWSDL(wsdl);
}
private function load(e:LoadEvent):void
{
ws.MethodName.addEventListener("result",onResult);
ws.MethodName.addEventListener("fault",faultHandler);
}
private function onResult(e:ResultEvent):void
{
returning=ws.MethodName.lastResult;
//我要在这里触发一个事件该怎么写?
}
private function faultHandler(event:FaultEvent):void
{
Alert.show(event.fault.toString(),'WebService Error');
}
}
} 展开
{
import flash.display.Sprite;
import flash.events.Event;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.soap.LoadEvent;
import mx.rpc.soap.Operation;
import mx.rpc.soap.WebService;
import flash.events.IEventDispatcher;
public class WSclass
{
public var ws:WebService=new WebService();
public var MethodName:String;
public var returning:String=new String();
public function WSclass(wsdl:String,methodname:String)
{
MethodName = methodname;
ws.addEventListener(LoadEvent.LOAD,load);
ws.loadWSDL(wsdl);
}
private function load(e:LoadEvent):void
{
ws.MethodName.addEventListener("result",onResult);
ws.MethodName.addEventListener("fault",faultHandler);
}
private function onResult(e:ResultEvent):void
{
returning=ws.MethodName.lastResult;
//我要在这里触发一个事件该怎么写?
}
private function faultHandler(event:FaultEvent):void
{
Alert.show(event.fault.toString(),'WebService Error');
}
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询