Solved

Check domain before play

Posted on 2006-11-25
8
195 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
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 how to load their YouTube profile onto Flash Media Live Encoder.

705 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

18 Experts available now in Live!

Get 1:1 Help Now