Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to discover the URL of the page Flash is embedded in?

Status
Not open for further replies.

ClarkeB

Technical User
May 1, 2002
2
US
Does anyone know how to discover the URL of the page Flash is embedded in?

You can use: "url = _root._url" to discover the url of the Flash movie itself, but I am looking for the url of the HTML page.

Thanks in advance for any help!

Clarke
 
Just a thought...

Maybe through a javascript function with something like location and/or history? Regards,

new.gif
 
Yeah! That works, but how would go about assigning that string to a variable within the movie itself?
Something like...

test = getURL ("javascript:window.location");
trace(test);

...Doesn't work! Trace displays nothing! Regards,

new.gif
 
Well, here's what I ended up doing:

I created an initFlash function that reads the URL for the current page, and passes the value to a variable in the Flash movie.

<script language = &quot;JavaScript&quot;>
<!--
function initFlash(){
window.document.varTest2.SetVariable(&quot;varTest&quot;, window.location);
}
//-->
</script>

Then, I call the initFlash function from the HTML onLoad event.

<BODY bgcolor=&quot;#CCCCFF&quot; onLoad=&quot;initFlash()&quot;>

It seems like there ought to be a better way, but this is working!
 
This is exactly the question I've been thinking about for some time now. Of course, this works with a JavaScript-function (as outlined by ClarkeB). The only problem is that for some browsers (IE on Mac etc.) the methods for Flash do not work at all! This is why you end up having no possibility of sending variables from the html document to the flash film.

Is there no way of checking the URL from the film itself?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top