title: Security Error when trying to call ActionScript function from JS
body: <p>I have a little test swf to test calling an ActionScript(3.0) function from JavaScript. I am using the Flash documentation as a reference:
   (<a href="http://www.adobe.ca/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&amp;file=00000340.html" rel="nofollow noreferrer">http://www.adobe.ca/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&amp;file=00000340.html</a>)
   When the page loads I am presented with a Flash Player error:</p>
  
  <pre><code>SecurityError: Error #2060: Security sandbox violation: ExternalInterface caller file: c:/externalinterface.swf cannot access file: c:\myhtml.html
  at flash.external::ExternalInterface$/_initJS()
      at flash.external::ExternalInterface$/addCallback()
      at externalinterface_fla::MainTimeline/frame1()
  </code></pre>
  
  <p>This is the ActionScript:</p>
  
  <pre><code> import flash.external.ExternalInterface
  
  function callMe(name:String):String{
  
      return "busy signal";
  
      }
  
      ExternalInterface.addCallback("myFunction",callMe);
  </code></pre>
  
  <p>And the JS:</p>
  
  <pre><code>&lt;script type="text/javascript" language="javascript"&gt;
      function callSwf() {
          var callResult = flashObject.myFunction("Nick");
          alert(callResult);
      }   
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Finally the HTML Object:</p>
  
  <pre><code>&lt;object width="550" height="400"&gt;
  &lt;param name="movie" value="externalinterface.swf"&gt;
  &lt;embed src="externalinterface.swf" width="550" height="400"&gt;
  &lt;/embed&gt;
  &lt;/object&gt;
  </code></pre>
  
  <p>How do we work around this?</p>