Solved

Check domain before play

Posted on 2006-11-25
8
197 Views
Last Modified: 2010-04-03
Hi experts,

I need to protect a flash movie. so how can I check that it is playing on my server?

Thanks
0
Comment
Question by:cabou
  • 4
  • 3
8 Comments
 
LVL 5

Expert Comment

by:blockage1
ID: 18012287
This will check if the file is being served from you domain:

if ( _url == "http://www.yourdomain.com/filename.swf" ) {
    // yes it is
} else {
   // no it isn't
}

To make this work replace "http://www.yourdomain.com/filename.swf" with the full url to your swf (including the quotes)



You will also need to make sure the swf isn't being hot linked from your server....

import flash.external.ExternalInterface;
var url = = ExternalInterface.call( "function(){return document.location.href;}" ).toString;
if ( url == "http://www.yourdomain.com/containerpage.html" ) {
    // yes it is
} else {
   // no it isn't
}

To make this work replace "http://www.yourdomain.com/containerpage.html" with the full url to the page holding your swf (including the quotes)
0
 
LVL 5

Expert Comment

by:blockage1
ID: 18012290
That should be...

import flash.external.ExternalInterface;
var url = = ExternalInterface.call( "function(){return document.location.href;}" ).toString();
if ( url == "http://www.yourdomain.com/containerpage.html" ) {
    // yes it is on your own page
} else {
   // no it is not on your page
}
0
 

Author Comment

by:cabou
ID: 18012305
ok, but I need to check the domain and not the page

thanks
0
 
LVL 13

Expert Comment

by:FLAASHER
ID: 18012308
try this :


if(host.domain() == "www.urdomain.com"){
      //play me
      }else{
            //dont play
            }




FLAASHER
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 13

Accepted Solution

by:
FLAASHER earned 250 total points
ID: 18012320
sorry :

this is the complete code :



host = new LocalConnection();
if(host.domain() == "www.urdomain.com"){
      gotoAndStop(30);

      }else{
            //dont play
            }

stop();



put it in ur frist frame


FLAASHER
0
 
LVL 13

Expert Comment

by:FLAASHER
ID: 18012336
i tested the new version and it works fine

just put it in ur frist frame and modify it with ur domain name






FLAASHER
0
 
LVL 5

Expert Comment

by:blockage1
ID: 18012354
That wont stop users hotlinking to your swf. This will...

var url = ExternalInterface.call( "function(){return document.location.href;}" ).toString();
if ( url.indexOf("www.yourdomain.com") == 7 ) {
    // yes it is on your own page
} else {
   // no it is not on your page
}

If you have subdomains you'll need to have seperate if statements for them too.
0
 
LVL 13

Expert Comment

by:FLAASHER
ID: 18012426
Thanks for the points









FLAASHER
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now