Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Check domain before play

Posted on 2006-11-25
8
Medium Priority
?
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Expert Comment

by:FLAASHER
ID: 18012308
try this :


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




FLAASHER
0
 
LVL 13

Accepted Solution

by:
FLAASHER earned 1000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

618 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