Javascript / SWFobject | Determine if swf exists when creating dynamic inline objects

When I create SWF objects that are temporarily hidden in tabs, so they are not fully loaded in some browsers like FireFox, I cannot find a way to find out if SWF is loaded or not, so I can communicate with it.

/* Generate SWF (onDocumentReady())*/ swfobject.embedSWF("graph.swf","line-graph-one","100%","250","8","expressInstall.swf",null,null,null,swfRegister); /* Callback function * ------------------- * Is triggered when SWF object has done it job, which is fine, but not a * suggestion that the SWF is actually loaded by the browser) */ function swfRegister(e){ console.log(e); } 

Here is what does not work. Although an element exists in the DOM, it is not possible to communicate with it in any way. FireFox in this case did not load SWF, because the parent container is hidden. (Display: none;)

 document.getElementById('line-graph-one').reloadAll("foobar"); Resulting in: document.getElementById("map-one").reloadAll is not a function 

It only works when I click on the tab in which the SWF is created. Therefore, FireFox loads it.

I need a way to check if it is loaded,

+1
source share
1 answer

Perhaps a visibility check first?

 var $el = $("#map-one"); if ( $el.is(':visible') ) { $el[0].reloadAll('foobar'); } 
+1
source

Source: https://habr.com/ru/post/1390400/


All Articles