Javascript question for Flash - Can I get my Flash to check if the page that loads the movie is the right one?

simms

Diamond Member
Sep 21, 2001
8,211
0
0
Sorry, verbose question to a simple solution. I have a *.swf that I made, and it's just a midi/mp3 file. Can I use a Jscript/Actionscript to make it so that it will check the URL of the document that's accessing it, before loading/playing? That way people can't hotlink my swf file and use it.

Any way around it, suggestions?
-Simon :)
 

simms

Diamond Member
Sep 21, 2001
8,211
0
0
yup, but it can't help much if i don't know what i'm looking for. in theory, i'm looking for something like:

<script>
alert(document.referrer);
if (document.referrer.indexOf('mysite.com')<0) {window.location.href="http://www.yahoo.com/index.html"}
</script>

So... is it telling me the document referrer, and then comparing it to the page that it should be loaded on? If not, then it loads Yahoo in the window? I have no idea :(

Simon