Equivalent of .send()
Is there an equivalent to LoadVars.send() in AS3 where I just send off variables without waiting for a response? I just send off the variables in开发者_StackOverflow社区to cyberspace blindly, and I am happy that way. How do I do it? Or has it been removed for some security thingie in AS3?
You want to take a look at the following URLLoader, URLRequest and URLVariable documentation:
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/net/URLVariables.html
Here's example usage directly from the documentation:
package {
import flash.display.Sprite;
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.net.URLLoader;
public class URLVariablesExample extends Sprite {
public function URLVariablesExample() {
var url:String = "http://www.[yourDomain].com/application.jsp";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.exampleSessionId = new Date().getTime();
variables.exampleUserLabel = "guest";
request.data = variables;
// navigateToUrl(request);
var loader:URLLoader = new URLLoader();
loader.load(request);
}
}
}
-BTW Yes, that's correct. You should be using URLLoader instead of navigateToURL. I mentioned it but I cut and paste from an example
精彩评论