views:

52

answers:

2

Is it possible to get page URL into flash ?

Without using ExternalInteface.call('window.location')

trace(this.loaderInfo.url) simply return URL from where flash was loaded.

Thank you.

A: 

http://code.google.com/p/urlkit/

Flakron Bytyqi
it's do the same thing! They want a simple solution. Something like System.ApplicationDomain.url or some property inside the player, to don't call javascript... (System.ApplicationDomain.url is NOT working it's just an example)
Roki
@Roki To be fair, he didn't know that at the time of posting. Look at the answer date.
Eric Muyser
+1  A: 

You need to pass it to FlashVars param in the HTML embed code.

To do this, add the following JS:

<script language="javascript">
    var page_url = document.location.href;
</script>

Then pass that variable to Flash:

<script type="text/javascript"> 
    AC_FL_RunContent( 
        'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0',
        'pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash',
        'width','550',
        'height','440',
        'src','myswffile',
        'quality','high',
        'movie','myswffile', 
        'flashvars', page_url
    ); 
</script>

Note: the code above assumes you're using AC_RunActiveContent.js javascript solution provided by Adobe.

Makram Saleh
or you can do it with swfobject too or a static embed code...
Roki
We can't do it, we just give our customers swf widget and have to be sure, that it is able to get URL. Without allowscriptaccess and some extra-params. We do not know how customer will place widgets on their sites
aaaauser
So then make it a JS widget, paste a small script tag. Then dynamically load AC_RunActiveContent.js or swfobject or static embed (document.write), and pass the document.location.href as a flashvar.
Eric Muyser
of course i know, that i can make JS widget and get/pass any param i want. I'm asking about pure flash solution
aaaauser
AFAIK, unfortunately, there isn't a way to do this purely in Flash.
Makram Saleh