如何使用 swfobject / JavaScript 在 Flash 中动态检索页面 URL

发布于 2024-08-09 19:12:06 字数 816 浏览 6 评论 0原文

我使用 Flash 和 AS3 创建了自己的视频播放器。在 Flash 电影中,我有一个链接,允许用户在自己的网站上复制对象嵌入代码和页面 url,类似于 youtube。播放器一切正常,并根据您拥有的页面检索正确的 flv。我的对象嵌入代码也工作正常。我遇到的问题是获取页面 URL。

正如您从下面的代码中看到的,我使用 swfobject2.2 将电影嵌入到我的网页上,并使用 FlashVars 在播放器中调用和播放 .flv。我只需要一些 JavaScript 代码来从任何页面返回特定的 url:flashvars.pageURL = " ";

我还应该提到,我正在 Eclipse 中使用 jsp。

<script type="text/javascript">
    var flashvars = {};
    flashvars.videoToPlay = "http://website.com/video1.flv";
    flashvars.pageURL = "This is the page url";
    var params = {};
    params.quality = "high";
    var attributes = {};

    swfobject.embedSWF("player.swf", "flashContent", "433", "328", 
        "9.0.0","expressInstall.swf", flashvars, params, attributes);
</script>

有谁知道我会怎么做?我认为可以使用 JavaScript 来完成。

谢谢
德克兰

I have created my own video player using Flash and AS3. Within the flash movie, i have a link which allows the user to copy the object embed code and page url on their own site, similiar to youtube. The player all works fine and retrieves the right flv's depending on what page you are own. I also have the object embed code working fine. What i am having trouble with is getting the page URL.

As you can see from my code below, i am using swfobject2.2 to embed the movie on my web page and i am using FlashVars to call and play .flv within the player. I just need some JavaScript code to bring back the specific url from whatever page: flashvars.pageURL = " ";

I should also mention, i am working with jsp's within Eclipse.

<script type="text/javascript">
    var flashvars = {};
    flashvars.videoToPlay = "http://website.com/video1.flv";
    flashvars.pageURL = "This is the page url";
    var params = {};
    params.quality = "high";
    var attributes = {};

    swfobject.embedSWF("player.swf", "flashContent", "433", "328", 
        "9.0.0","expressInstall.swf", flashvars, params, attributes);
</script>

Does anyone know how i would do this? I presume it can be done using JavaScript.

thanks
Declan

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深居我梦 2024-08-16 19:12:06

根据 W3C,document.URL 应该可以解决问题:

flashvars.pageURL = document.URL;

According to W3C, document.URL should do the trick:

flashvars.pageURL = document.URL;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文