Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从php中检索变量并通过AS3发送到js函数_Php_Actionscript 3_Flash - Fatal编程技术网

从php中检索变量并通过AS3发送到js函数

从php中检索变量并通过AS3发送到js函数,php,actionscript-3,flash,Php,Actionscript 3,Flash,谁能告诉我如何从我发布到的php文件中检索响应,然后将它们发送到js函数 我在脚本中还有一个动画gif图像,它没有显示动画。有人能让这个也起作用吗 php响应的格式为variable1=blabla&varaibale2=blabla function sendPixelData(e:MouseEvent):void { capture_mc.visible = false; send_mc.visible = false; txtReturn.htmlText="Upl

谁能告诉我如何从我发布到的php文件中检索响应,然后将它们发送到js函数

我在脚本中还有一个动画gif图像,它没有显示动画。有人能让这个也起作用吗

php响应的格式为variable1=blabla&varaibale2=blabla

function sendPixelData(e:MouseEvent):void {
      capture_mc.visible = false;
 send_mc.visible = false;

    txtReturn.htmlText="Uploading Image......<img src="loading.gif" /><br/> Please Wait!";
    var output:String = "";
    var col = "";
    for (var i:Number=0; i<bitmapData.height; i++) {
        for (var j:Number=0; j<bitmapData.width; j++) {
            col = bitmapData.getPixel(j,i).toString(16);
            // In some cases, the color will be truncated (e.g. "00FF00" becomes "FF00")  
            // so we are adding the missing zeros.  
            while (col.length<6) {
                col = "0" + col;
            }
            output += col;
        }
    }
    var request:URLRequest = new URLRequest("GetPixelData.php");
    var variables:URLVariables = new URLVariables();
    var myURLLoader:URLLoader = new URLLoader();
    variables.pixels=output;// all image pixel
    //trace("output" + output)
    variables.width=videoPreviewWidth;// video width
    variables.height=videoPreviewHeight;// video height
    request.data=variables;
    request.method=URLRequestMethod.POST;
    myURLLoader.addEventListener ("complete", onC);
    myURLLoader.load (request);
    function onC (e) {

         var result:String = 
      ExternalInterface.call( "redirectToURL(send variables here)" );
        trace ("save complete");
    }
}
函数sendPixelData(e:MouseEvent):无效{ 捕获可视=假; send_mc.visible=false; txtreurn.htmlText=“正在上传图像……
请稍候!”; var输出:String=“”; var col=“”;
对于(var i:Number=0;iPHP的结果存储在URLLoader的数据属性中,因此要检索它,请使用:

function onC (e:Event) {
    var result:String = String(e.target.data);
    ...etc
对于问题的第2部分,Flash不支持gif文件格式-您需要使用jpg或png

顺便说一句,不要对事件类型使用字符串-使用事件类型常量,例如:

myURLLoader.addEventListener (Event.COMPLETE, onC);