Javascript check if function exists
<p>I followed this guide to create a new a js to flash communication:
<a href="http://www.actionscript.org/resources/articles/638/1/Basics-of-using-the-ExternalInterface/Page1.html">http://www.actionscript.org/resources/articles/638/1/Basics-of-using-the-ExternalInterface/Page1.html</a></p>

<p>So my code looks like:</p>

<pre><code>function getID( swfID ){
     if(navigator.appName.indexOf("Microsoft") != -1){
          me = window[swfID];
     }else{
          me = document[swfID];
     }
}

function js_to_as( str ){
     me.onChange(str);
}
</code></pre>

<p>Now sometimes, my onChange does not load, but currently, firebug displays a "me.onChange is not a function" error and completely stops. I want it to degrade gracefully because this is not the most important feature in my program. I tried typeof but that still gives the same error.</p>

<p>Any suggestions on how to make sure that it exists and then only execute onChange?</p>

<p>Thank you for your time.</p>

<p><strong>UPDATE</strong> None of the methods below except try catch one work.</p>
