如何设置如$ _POST或$ _REQUEST从ActionScript3的参数? [英] How to set parameters like $_POST or $_REQUEST from actionscript3?
本文介绍了如何设置如$ _POST或$ _REQUEST从ActionScript3的参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用PHP文件从闪存内进行通信。
I am trying to communicate with a php file from within the flash.
我想设置 $ _ REQUEST ['使用setData'] =真正的
从Flash文件。这是我的PHP code。
I want to set the $_REQUEST['setData']= "true"
from the flash file. Here is my php code.
<?php
if($_REQUEST['setData']=="true")
{
echo "setData";
}
?>
我在的ActionScript3 code迄今为止 -
What I have in actionscript3 code so far -
var phpVars:URLVariables = new URLVariables();
var phpFileRequest:URLRequest = new URLRequest("php/index.php");
phpFileRequest.method = URLRequestMethod.POST;
phpFileRequest.data = phpVars;
var phpLoader:URLLoader=new URLLoader();
phpLoader.addEventListener(Event.COMPLETE, showResult);
phpLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);
phpLoader.addEventListener(IOErrorEvent.IO_ERROR, ioError);
phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
phpVars.email = email.text;
phpVars.password = password.text;
phpLoader.load(phpFileRequest)
我怎样才能做到这一点? 谢谢
How can I do this? Thanks
推荐答案
刚刚从读您的code,没有知识是,我猜这里
Just from reading your code, no knowledge of AS, I am guessing here
var phpVars:URLVariables = new URLVariables();
var phpFileRequest:URLRequest = new URLRequest("php/index.php");
phpVars.email = email.text;
phpVars.password = password.text;
phpVars.setData= 'true';//**************** LOOK HERE!!!!!!!!!!!!!!!!!!
phpFileRequest.method = URLRequestMethod.POST;
phpFileRequest.data = phpVars;
var phpLoader:URLLoader=new URLLoader();
phpLoader.addEventListener(Event.COMPLETE, showResult);
phpLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);
phpLoader.addEventListener(IOErrorEvent.IO_ERROR, ioError);
phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
phpLoader.load(phpFileRequest)
这篇关于如何设置如$ _POST或$ _REQUEST从ActionScript3的参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文