AS3 - 调用PHP脚本,我的服务器上,以确定SWF的URL [英] AS3 - Call a PHP script on my server to determine the URL of the SWF

查看:117
本文介绍了AS3 - 调用PHP脚本,我的服务器上,以确定SWF的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个flash游戏开发者。我需要能够确定该SWF是嵌入在网页的网址,而我不能使用ExternalInterface的。其原因是很多闪光的门户网站设置的allowScriptAccess =从不。这也是闪存门户网站实际上并不主办的SWF本身相当普遍,但嵌入到SWF在他们的网页,并把它从别人的服务器加载。我需要一个可靠的方法来确定该SWF是嵌入在网页的网址,我可以使用一个外部服务器。

I'm a flash game developer. I need to be able to determine the URL of the page that the SWF is embedded on, and I can't use ExternalInterface. The reason is that a lot of flash portals set allowScriptAccess="never". It's also quite common for flash portals to not actually host the SWF themselves, but embed the SWF on their page and have it loaded from someone else's server. I need a reliable way to determine the URL of the page that the SWF is embedded on, and I can use an external server.

我知道这是不可能单独使用闪光灯,但我相信它应该可以结合使用外部服务器。

I know this isn't possible using flash alone, but I believe it should be possible in combination with using an external server.

在寻找,我碰到一个论坛帖子,上面写着想通了:服务器可以得到网页联系地址(当浏览器请求文件服务器可以读取页面联系地址)并返回作为参数闪烁。不幸的是,没有提供任何进一步的细节。该线程可以在这里找到:

While searching, I came across a forum post that said "Figured it out: Server can get page adress (when browser request file server can read page adress) and return it as param to flash." Unfortunately, no further details were provided. That thread can be found here:

http://www.actionscript.org/forums/showthread.php3? T = 138370

我甚至不知道PHP是我要找的 - 我有网络技术一知半解的闪存之外。我的问题是:

I'm not even sure if PHP is what I'm looking for - I have little knowledge of web technologies outside of Flash. My questions are:

  1. 这实际上是可能的?
  2. 如果是这样,我应该怎么使用做到这一点? PHP是我在找什么?别的东西?

更新: 我的目标(但是它可以被实现)是获得该SWF正在观看上而不依赖于任何特定的嵌入设置(因此没有ExternalInterface的,或传递一个的FlashVar)的URL。我不会在如何以及在何处SWF嵌入控制。 〔实施例中,SWF托管在somedomain.com/test.swf,它的嵌入fungames.com/cool-game。我需要知道该URL fungames.com/cool-game。了解在实际的SWF文件托管是没有用的信息。如果完整的URL不是索取,域名就足够了。

Update: My goal (however it can be achieved) is to get the URL that the SWF is being viewed on WITHOUT being dependent on any particular embed settings (so no ExternalInterface, or passing in a FlashVar). I won't have control over how and where the SWF is embedded. Exmaple, the SWF is hosted on somedomain.com/test.swf, and it's embedded on fungames.com/cool-game. I need to know that the URL is fungames.com/cool-game. Knowing where the actual SWF file is hosted is not useful information. If the full URL is not obtainable, the domain would be good enough.

更新2: 我的设置与AMFPHP我的服务器上,而我得到了它返回HTTP_REFERER,但在我的测试情况下,返回的SWF的URL,而不是该SWF是嵌入在网页的URL。是否有不同的属性,我可以看看?

Update 2: I got setup with AMFPHP on my server, and I got it to return the HTTP_REFERER, but in my test case, it returned the URL of the SWF and not the URL of the page that the SWF is embedded on. Is there a different property I can look at?

推荐答案

您可以通过使用该得到一个正在运行的SWF的网址:

You can get the URL of a running SWF by using this:

var url:String = LoaderInfo(root.loaderInfo).url;

这篇关于AS3 - 调用PHP脚本,我的服务器上,以确定SWF的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆