title: Domain Locking – Multiple Domains
body: <p>Noob needed some help here.</p>
  
  <p>I am trying to use this code code snippets to lock a swf to couples of domain names.</p>
  
  <pre><code>var allowedDomains:String = "ghostwire.com|somewhere.net|elsewhere.org";
  
  var allowedPattern:String = "^http(|s)://("+allowedDomains+")/";
  var domainCheck:RegExp = new RegExp(allowedPattern,"i");
  if (!domainCheck.test(url))
  {
      // domain check failed, abort application
      stop();
      // abort();
  }
  else
  {
      // domain okay, proceed
  }
  </code></pre>
  
  <p>problem is even when I add my sites like:</p>
  
  <p>var allowedDomains:String = "mysite.nl|mysite.de|mysite.co.uk";</p>
  
  <p>The swf use the abort() function.</p>
  
  <p>This one works grab the domain URL alright. But There isn't a way to add Multiple Domains</p>
  
  <pre><code>var url:String = stage.loaderInfo.url;
              var goodPattern:RegExp = /^(http:\/\/)(www\.)?mysite\.nl/;
              if (goodPattern.test(url) == true)
              {
                  trace("This flash is hosted on mysite");
              }
              else
              {
                  trace("This flash is not hosted on mysite");
                  this.alpha = 0;
              };
  </code></pre>
  
  <p>The above snippets works.
  But then given me two other issues.
  1: I cant add more then one domain name.
  2: after code obfuscated, the stage get nulled, soo when try to play the swf i get a debugger error.</p>
  
  <p>TypeError: Error #1009: null object</p>
  
  <p>can somebody please tell me what I am doing wrong here!!!</p>
  
  <p>original link here:</p>
  
  <p>PS: I am a newbie, and not banned from here.
  I just couldn't find my older details, and when trying to get the script to sent me a new details via e-mail, I got a message that used email which was good, wasn't into this database.</p>
  
  <p>soo I a message was promp to use my google account which I did, sorry If this was wrong.</p>
  
  <p>Hope to get some help consern my thread.
  Thanks in advance</p>