all groups > flash (macromedia) > may 2004 >
You're in the

flash (macromedia)

group:

how to know if a movie is run locally or remotely


how to know if a movie is run locally or remotely flashin
5/29/2004 10:39:18 PM
flash (macromedia): I have a flash movie embedded in html page. But I only want the movie to be
played locally. I have to use html since I need some javescripting. Since the
movie is embedded in html. the users can play it over the net. In order to stop
the user from playing it over the net, I want to find way to detect if the
movie html page is opened locally or remotely, so that I can do something like
this in flash:

if (the move not run locally) {
warn the user and then exit
}

How to detect if the movie is played locally or remotely? In order words, how
to make sure an html page can only be opened locally? Are there other
alternatives to solve my problem?
Re: how to know if a movie is run locally or remotely Jeff North
5/30/2004 1:42:43 AM
On Sat, 29 May 2004 22:39:18 +0000 (UTC), in macromedia.flash
[quoted text, click to view]

You could use javascripting on your web page. Place your movies into a
div
<div id="movie01" style="display:block">
<!-- movie object goes here -->
</div>
<div id="movie02" style="display:block">
<!-- movie object goes here -->
</div>

After your </html> tag place the following script.
<script type="text/javascript">
var loc = document.location.href;
if( loc.indexOf("http") >= 0 )
{
//--- hide all div's with and id of movie???
var x = document.getElementsByTagName("DIV");
var n = new String();
// --- turn off all other named divs
for(var i=0; i<x.length; i++)
{
//--- get the idname of the tag
n = x[i].id;
if( n.indexOf("movie") != -1)
x[i].style.display = "none";
}
}
</script>

This will hide the divs from the user. They are still running in the
background. ANy experienced user will be able to circumvent this but
that's the nature of javascript.

Oh BTW, this will work in DOM2 compliant browswer.

HTH
---------------------------------------------------------------
jnorth@yourpantsbigpond.net.au : Remove your pants to reply
Re: how to know if a movie is run locally or remotely Jeff North
5/30/2004 2:01:27 AM
On Sat, 29 May 2004 22:39:18 +0000 (UTC), in macromedia.flash
[quoted text, click to view]

In addition to my previous post.

document.location.URL is a string-valued property containing the full
URL of the document. It usually matches what window.location.href is
set to when you load the document, but redirection may change
location.href.
---------------------------------------------------------------
jnorth@yourpantsbigpond.net.au : Remove your pants to reply
Re: how to know if a movie is run locally or remotely flashin
5/30/2004 3:55:03 AM
Re: how to know if a movie is run locally or remotely urami_
5/30/2004 9:25:20 AM

[quoted text, click to view]

host = new LocalConnection();
trace(host.domain());

It will return LocalHost if run locally and DomainName.com if run on server.
You can do If Else condition to see if it is local host against other location
and based on result do stuff.

host = new LocalConnection();
nameHere = host.domain();
Origin = "localhost";
if (nameHere == Origin) {
trace("whoha... i'm home");
} else {
trace("booo....theif");
}



--

Regards


urami_*



<no>
http://flashfugitive.com/
</no>

AddThis Social Bookmark Button