如何使用 swfobject / JavaScript 在 Flash 中动态检索页面 URL
我使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 W3C,document.URL 应该可以解决问题:
According to W3C, document.URL should do the trick: