How to check if swf is loaded using JavaScript with swfobject?

I have the following swf:

    <head>
    # load js
    <script>
    function graph() {
     swfobject.embedSWF(
     "open-flash-chart.swf", "chart", "400", "180", "9.0.0", "expressInstall.swf",
     {"data-file":"{% url monitor-graph %}"});
        };
    </script></head>

<div id="chart"> </div>
<script>
graph();
</script>

I would like to name the graph function only if swf is not loaded yet, is there any way to do this? Thank.

+3
source share
3 answers

The final argument embedSWFis the callback function, which is called when swf is inserted. It takes an event object with several properties indicating success / failure, etc. See the swfobject documentation for more on this .

swfobject.embedSWF(
 "open-flash-chart.swf", "chart", "400", "180", "9.0.0", "expressInstall.swf",
 {"data-file":"{% url monitor-graph %}"}, {}, {}, 
   function(e) {
     if(e.success) graph();
   }
 );
-6
source

Use SWFObject to insert the SWF, then use the callback function to poll the SWF value PercentLoaded.

0, SWF . 100, SWF .

PercentLoaded, .

+9

swfobject , DOM . , SWF.

swfobject:

. , Flash- DOM Flash SWF. SWFObject , swf.

0

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


All Articles