ActionScript 2.0 Components Language Reference |
|
|
|
| WebServiceConnector component > WebServiceConnector.result | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
componentInstance.addEventListener("result",myListenerObject)
Event; broadcast when a call to a web service completes successfully.
The parameter to the event handler is an object with the following fields:
type: the string "result"target: a reference to the object that emitted the event (for example, a WebServiceConnector component)You can retrieve the actual result value using the results property.
The following example defines a function res for the result event and assigns the function to the addEventListener event handler:
var res = function (ev) {
trace(ev.target.results);
};
wsc.addEventListener("result", res);
This example returns data from a remote web service and traces a tip. Drag a WebServiceConnector component into your library, and enter the following code on Frame 1 of the timeline:
import mx.data.components.WebServiceConnector;
var wscListener:Object = new Object();
wscListener.result = function(evt:Object) {
trace(evt.target.results);
};
var wsConn:WebServiceConnector = new WebServiceConnector();
wsConn.addEventListener("result", wscListener);
wsConn.WSDLURL = "http://www.flash-mx.com/mm/tips/tips.cfc?wsdl";
wsConn.operation = "getTipByProduct";
wsConn.params = ["Flash"];
wsConn.trigger();
|
|
|
|