从 SWF 文件的 URL 中抓取一些特定的文本?动作脚本 3.0
Grabbing some specific text from the URL of the SWF file? Action Script 3.0
好的,所以我有一个将放置在网站上的横幅,并且根据 url 我需要更新 swf 横幅中的文本。我需要抓取的文本在 URL.
中是这样的
产品="abc"
"abc"可能是不同的字符数。我没有确切的 url 可以使用。
我在这里得到了部分答案:Get Current Browser URL - ActionScript 3
然而,这并没有解释我如何只能具体地获取产品名称。
谢谢你
您需要一个网络服务或 flashvars 来了解当前的产品。
希望对您有所帮助。
:)
你可以这样做:
//check to make sure you can use ExternalInterface
if(ExternalInterface.available){
//grab the url from JavaScript
var url:String = ExternalInterface.call("window.location.href.toString");
//make sure the url is valid and has querystring parameters (eg a ?)
if(url && url.length > 0 && url.indexOf("?") > -1){
//split the url and grab everything after the ?, convert that into URL variable object
var params:URLVariables = new URLVariables(url.split("?")[1]);
trace(params.product); //abc
}
}
有关正确获取 url 的更多信息,请参阅 this question
的答案
好的,所以我有一个将放置在网站上的横幅,并且根据 url 我需要更新 swf 横幅中的文本。我需要抓取的文本在 URL.
中是这样的产品="abc"
"abc"可能是不同的字符数。我没有确切的 url 可以使用。
我在这里得到了部分答案:Get Current Browser URL - ActionScript 3
然而,这并没有解释我如何只能具体地获取产品名称。
谢谢你
您需要一个网络服务或 flashvars 来了解当前的产品。
希望对您有所帮助。
:)
你可以这样做:
//check to make sure you can use ExternalInterface
if(ExternalInterface.available){
//grab the url from JavaScript
var url:String = ExternalInterface.call("window.location.href.toString");
//make sure the url is valid and has querystring parameters (eg a ?)
if(url && url.length > 0 && url.indexOf("?") > -1){
//split the url and grab everything after the ?, convert that into URL variable object
var params:URLVariables = new URLVariables(url.split("?")[1]);
trace(params.product); //abc
}
}
有关正确获取 url 的更多信息,请参阅 this question
的答案