闪光的ActionScript抢查询字符串值 [英] Flash ActionScript Grab Query String Value
问题描述
我需要从查询字符串抢价值观和它们注入到getURL();片段,是在(释放){}的按钮。
I need to grab values from the querystring and inject them into a getURL(""); snippet that's in the on (release) {} for a button.
因此,如果包含嵌入的SWF的URL是
So if the URL that contains the embedded swf is
http://domain.com/player.html?returndomain=otherdomain.com
我想获得的otherdomain.com并注入。类似于
I'd like to get that otherdomain.com and inject it. Something like
var returnUrl = "";
// do magic querystring getting
getURL(returnUrl);
*编辑:我要捡的查询字符串,因为我没有访问嵌入code。它是被由第三方(口齿)呈现并装入一个帧。我确实有机会获得code呈现框架HTML,这就是为什么我想查询字符串将是最好的途径,和一个按钮多数民众赞成在presentation使用。
* I need to snag the querystring because I don't have access to the embed code. It's being rendered by a third party (Articulate) and loaded into a frame. I do have access to the code that renders the frame html, which is why I figured query string would be the best route, and one button that's used in the presentation.
请注意,我住在C#中的土地,没有土地的动作,所以我最有可能的屠杀的语法。我只需要得到这个按钮工作作为一次性的,我可能永远不会处理它了。
Note, I live in C# land, not ActionScript land so I most likely butchered the syntax. I just need to get this button working as a one off and I'll probably never deal with it again.
顺便说一句,我见过的abdulqabiz查询字符串对象的Floating各地在那里,但它似乎有点像矫枉过正,像有应该是烤成这个框架。我也缺乏如何将其纳入我的小按钮(释放){}事件
BTW, I've seen the abdulqabiz QueryString object that's floating around out there but it kind of seems like overkill, like there should be something baked into the framework for this. I also lack the knowledge of how to incorporate this into my little button on (release) {} event
推荐答案
您可以得到查询字符串是这样的:
You can get the query string like this:
import flash.external.ExternalInterface;
var queryString:String = String(ExternalInterface.call("function() { return window.location.search; }"));
有关你上面的例子,它会返回?returndomain = otherdomain.com,其中包括了问号。
For your example above, it would return "?returndomain=otherdomain.com", including the question mark.
this.loaderInfo.url,即建议在这里评论,是的ActionScript 3,在ActionScript 2这将是this._url,并给你的swf文件,而不是网页的URL的URL。
this.loaderInfo.url, that is suggested in comments here, is ActionScript 3, in ActionScript 2 it would be this._url, and will give you the URL of the swf file, not the URL of the page.
这篇关于闪光的ActionScript抢查询字符串值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!