navigateToURL不起作用

时间:2015-11-26 12:45:13

标签: flash navigatetourl

我使用这段代码很长时间了。它完美地运作。现在,我制作PHP 5.4。它保存了图片,但它没有进入网站daten.php。当我点击保存时,只保存图片。

var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");       
//Create the thumbnail file name
var dotLoc:Number = currentImageName.lastIndexOf(".");
var prefix = currentImageName.substr(0, dotLoc);
var ext = currentImageName.substr(dotLoc);
var thumbName = prefix + "_thumb" + ext;

// Send the data out to PHP to be saved
var jpgURLRequest:URLRequest = new URLRequest ("http://www.domain/datei.php?name=" + thumbName);
jpgURLRequest.data = jpgData;
jpgURLRequest.requestHeaders.push(header);
jpgURLRequest.method = URLRequestMethod.POST;
var jpgURLLoader:URLLoader = new URLLoader();       
jpgURLLoader.addEventListener(Event.COMPLETE, saveComplete);
jpgURLLoader.load(jpgURLRequest);
navigateToURL(jpgURLRequest,"_blank")

2 个答案:

答案 0 :(得分:0)

如果我理解正确,数据会保存在服务器上,但navigateToURL()不起作用?我听说过Chrome浏览器中与此相关的一些问题,而且一些弹出窗口阻止程序可能会阻止navigateToURL()。

现在最好通过ExternalInterface使用JavaScript来打开新页面(当然,它只能在浏览器中运行,而不能在独立的Flash播放器中运行,并且您的用户必须在浏览器中启用Javascript,这是默认设置):

ExternalInterface.call("window.open", "http://www.domain/datei.php?name=" + thumbName, "_blank");

答案 1 :(得分:0)

您的对象嵌入有问题 - 这个嵌入似乎对我有用(在Chrome中测试):

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" id="TestActionScript">
    <param name="movie" value="ThumbCreator.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#ffffff" />
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="allowFullScreen" value="true" />
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="ThumbCreator.swf" width="100%" height="100%">
        <param name="quality" value="high" />
        <param name="bgcolor" value="#ffffff" />
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="allowFullScreen" value="true" />
    <!--<![endif]-->
    <!--[if gte IE 6]>-->
    <p> 
        Either scripts and active content are not permitted to run or Adobe Flash Player version
        11.4.0 or greater is not installed.
    </p>
    <!--<![endif]-->
        <a href="http://www.adobe.com/go/getflashplayer">
            <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
        </a>
    <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
</object>