Provider usage
import com.flashdb.provider
var p = new provider()
function handleResult(res){
trace(unescape(res))
}
//whithout fourth parameter, is just a load
p.loadData("some.txt", this, "handleData", false)
//whith fourth parameter, is a sendAndLoad
p.loadData("some.php", this, "handleData", {nr:1, name:"jorge"})
Both calls use the same function as callback. The first don't pass any arguments, while the second pass an object that will be copied to the LoadVars object and passed to the back end script. Arguments of the loadData method are:
- url:String the url to load or load and send variables
- timeline:MovieClip to set scope for the callback function
- callback:String the name of the function to call back
- props:Object properties to copy to the LoadVars object
Webservice Provider usage
import com.flashdb.webserviceProvider;
function handleResult(res) {
lista.text = ""
for (var i=0; i<res.length; i++) {
lista.text += res[i].name;
}
summary.text = res.length+" services, consult http://www.xmethods.net"
}
service = new webserviceProvider("http://www.xmethods.net/interfaces/query.wsdl");
load_btn.onPress = function() {
lista.text = "Loading ..."
service.callMethod("getAllServiceNames", this._parent, "handleResult", "", false);
};
Here we construct a web service and call without parameters (that's because the empty string as third and false as forth parameter) We set the callback as the handleResult function, where we should parse the result, that means, we should know the result structure. Parameters are:
- method:function , the method to be called
- timeline:MovieClip , to set the callback scope
- callback:String , the callback to use when result arrives
- props:Object , arguments to be used in the call
- asObject:Boolean , flag to pass the object as it is or as a series of arguments
Remoting Provider usage
import com.flashdb.remotingProvider
//Instance of remoting service
myProvider = new remotingProvider("gateway.php", "HelloWorld")
//callback function
function onEchoData(msg){
showRes.text = msg
}
//Buttons handlers
callButton.onPress = function(){
myProvider.callMethod("makeEcho", this._parent, "onEchoData", {msg:"Hello from remotingPovider class"}, false)
}
clearButton.onPress = function(){
showRes.text = "";
};
Here we construct a remoting provider and call passing a string parameters. note that even when using simple parameters, we packet in an object and pass a false as the flag, so the class knows that it should pass object parameters as simple arguments to the service. We set the callback as the handleResult function, where we should parse the result, that means, we should know the result structure. Parameters are:
- method:string , the services to be called
- timeline:MovieClip , to set the callback scope
- callback:String , the callback to use when result arrives
- props:Object , arguments to be used in the call
- asObject:Boolean , flag to pass the object as it is or as a series of arguments
Since classes are short, let's take a look at it.

5 most recent
Flash streaming servers
Tree menu
Flash Spell Checker
Flash Remoting Library
MX 2004 Chart/Poll
Articles