ActionScript 2.0 Components Language Reference |
|
|
|
| WebServiceConnector component >
WebServiceConnector.suppress InvalidCalls |
|||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
componentInstance.suppressInvalidCalls
Property; indicates whether to suppress a call if parameters are invalid. If this property is true, the trigger() method does not perform a call if the bound parameters fail the validation. A status event is emitted, with the code InvalidParams. If this property is false, the call takes place, using the invalid data as required.
This example displays an error because the required parameters are not being passed. Drag a WebServiceConnector component into your library, and enter the following code on Frame 1 of the timeline:
import mx.data.components.WebServiceConnector;
var res:Function = function (evt:Object) {
trace(evt.target.results);
};
var stat:Function = function (error:Object) {
switch (error.code) {
case 'InvalidParams' :
trace("Unable to connect to remote Web Service: "+error.code);
break;
case 'StatusChange' :
break;
default :
trace("Error: "+error.code);
break;
}
};
var wsConn:WebServiceConnector = new WebServiceConnector();
wsConn.addEventListener("result", res);
wsConn.addEventListener("status", stat);
wsConn.WSDLURL = "http://www.flash-mx.com/mm/tips/tips.cfc?wsdl";
wsConn.operation = "getTipByProduct";
// wsConn.params = ["Flash"];
wsConn.suppressInvalidCalls = true;
wsConn.trigger();
To display a tip instead of an error, uncomment the line wsConn.params = ["Flash"];.
|
|
|
|