As3 模拟As2.0 LoadVars传参

来源:互联网 发布:sql case when 多字段 编辑:程序博客网 时间:2024/06/05 02:02
AS3.0 中已经没有了loadVars. 对于习惯使用AS2.0 loadVars传参的可以参考一下. varmyRequest:URLRequest = newURLRequest("http://www.webstudio.com.cn/msg.php"); varmyLoader:URLLoader = new URLLoader(); var myVariables:URLVariables= new URLVariables(); myLoader.addEventListener(Event.COMPLETE,loadSuccessful); myLoader.addEventListener(IOErrorEvent.IO_ERROR,loadError); myVariables.var1 = "hello"; myVariables.var2= "hi"; myRequest.method = URLRequestMethod.POST;myRequest.data = myVariables; myLoader.load(myRequest); functionloadSuccessful($evt:Event):void { trace("参数已发送"); }function loadError($evt:IOErrorEvent):void {trace("发送失败."); }
原创粉丝点击