Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.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
Flash 从浏览器链接获取查询字符串_Flash_Actionscript - Fatal编程技术网

Flash 从浏览器链接获取查询字符串

Flash 从浏览器链接获取查询字符串,flash,actionscript,Flash,Actionscript,如何将浏览器中的查询字符串值输入到flash电影中 例如,链接是www.blah.com/index.html?name=John。html页面加载flash电影,我希望flash电影能够访问变量name=John 这可能吗?假设ActionScript 3 结帐: 几乎是:ExternalInterface.call(“window.location.href.toString”) 那么我想你可以从字符串中找到你需要的东西 或者,您可以使用FlashVar并传递所需内容: 在嵌入标记中,它是:

如何将浏览器中的查询字符串值输入到flash电影中

例如,链接是www.blah.com/index.html?name=John。html页面加载flash电影,我希望flash电影能够访问变量
name=John


这可能吗?

假设ActionScript 3

结帐:

几乎是:
ExternalInterface.call(“window.location.href.toString”)

那么我想你可以从字符串中找到你需要的东西

或者,您可以使用FlashVar并传递所需内容:


在嵌入标记中,它是:
FlashVars=“one=1&two=2”
和param:

我建议通过javascript或一些服务器端语言(如PHP)读取变量,并将它们发送到swf,如下所示:

function getURLParameter(name) {
    return decodeURI(
        (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
    );
}

"yourflashfile.swf?variable1=" + getURLParameter("parameter1") + "&variabl2=" + getURLParameter("parameter2")
然后在ActionScript中使用:

var variable1:String = loaderInfo.parameters.variable1 || "";