开发者

How to dynamically retrieve the page URL within Flash using swfobject / 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 开发者_如何学Gopage 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


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

flashvars.pageURL = document.URL;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜