Problem med eventlistener
Jeg kan ikke få min eventlistener til at virke. Klassen skal sende en mail ved at kalde en webservice, og derefter returnere resultatet. Min klasse ser således ud:import AsBroadcaster;
import mx.data.components.WebServiceConnector;
class Mail
{
//--------------------VARS---------------------------
private var _wsConn:WebServiceConnector;
public var addListener:Function;
public var removeListener:Function;
private var broadcastMessage:Function;
public function Mail()
{
_wsConn = new WebServiceConnector();
_wsConn.WSDLURL = "...";
AsBroadcaster.initialize(this);
}
public function sendMail():Boolean {
_wsConn.params = []; //Parameters to include
_wsConn.operation = "sendMail"; //Method to call
_wsConn.addEventListener("result", res);
_wsConn.trigger();
return true;
}
private function res (evt:Object) {
trace("Result received")
this.broadcastMessage("checking");
}
}
Og min fla:
import Mail;
var model:Mail = new Mail();
var listener:Object = new Object();
listener.checking = function(time){
trace("Checking was received.");
}
model.addListener(listener);
model.sendMail();