title: Actionscript 3 javascript communication: Object #<HTMLEmbedElement> has no method
body: <p>I'm trying to call an Actionscript 3 method from Javascript but Chromes gives the error below:</p>
  
  <blockquote>
    <p>Object #&lt;HTMLEmbedElement&gt; has no
    method</p>
  </blockquote>
  
  <p>I put my SWF to the page as below:</p>
  
  <pre><code>&lt;embed type="application/x-shockwave-flash" src="/subfolder/flash.swf" width="550" height="400" id="myFlash" name="myFlash" bgcolor="#FFFFFF" quality="high" /&gt;
  </code></pre>
  
  <p>Actionscript 3 Code:</p>
  
  <pre><code>function query(fn:String, ln:String):void {
      a_txt.text = fn + " " + ln;
  }
  ExternalInterface.addCallback("queryFlash", query);
  </code></pre>
  
  <p>And finally Javascript:</p>
  
  <pre><code>function getFlashMovie(movieName) {
        var isIE = navigator.appName.indexOf("Microsoft") != -1;
        return (isIE) ? window[movieName] : document[movieName];
      }
  $(document).ready(function() {
      getFlashMovie("myFlash").queryFlash("a", "b");
  });
  </code></pre>
  
  <p>Am I missing something here?</p>