Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Answering my own question: <a href="https://sourceforge.net/forum/message.php?msg_id=5929756" rel="noreferrer">https://sourceforge.net/forum/message.php?msg_id=5929756</a></p> <ol> <li>Define a Javascript function that should be invoked if Flash loaded.</li> <li>Invoke this method from the top of your Flash file.</li> <li>Use a timer to detect if the callback is never invoked.</li> <li>Prefer invoking Javascript functions from Flash rather than invoking Flash functions from Javascript. Either way you cannot invoke a function that has not been loaded yet. It is far easier to guarantee that the browser has finished loading your Javascript function before invoking it from Flash, than guaranteeing that Flash finished loading your Flash function before invoking it from Javascript.</li> </ol> <p>Here is an example:</p> <ul> <li>I am using <a href="http://code.google.com/p/swfobject/" rel="noreferrer">swfobject</a> to embed Flash.</li> <li>I use FlashVars to tell Flash which Javascript function to invoke. This is useful if there are multiple Flash objects on the page.</li> </ul> <p><strong>Flash</strong></p> <pre><code>var params:Object = LoaderInfo(this.root.loaderInfo).parameters; if (ExternalInterface.available) { var onLoaded:String = params["onLoaded"]; if (onLoaded != null) ExternalInterface.call(onLoaded, true); } </code></pre> <p><strong>Javascript</strong></p> <pre><code>var flashLoaded = false; var flashTimer; function onFlashLoaded() { flashLoaded = true; clearTimeout(flashTimer); } function onFlashTimeout() { if (!isFlashLoaded) { // Remove the Flash object in case it is partially loaded $("#videoFeed").empty(); $("#videoFeed").append('&lt;div id="flashObject"&gt;&lt;/div&gt;'); alert("Failed to load video player"); } clearTimeout(flashTimer); } function connectToVideo() { var flashvars = {}; flashvars.onLoaded = "onFlashLoaded"; var params = {}; params.menu = false; var attributes = {}; isFlashLoaded = false; flashTimer = setTimeout("onFlashTimeout()", 5000); swfobject.embedSWF("flash/VideoFeed.swf", "flashObject", "800", "600", "11", "expressInstall.swf", flashvars, params, attributes); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload