<p>I'm using Flash to play an .flv movieclip on my site, but I want to have the .swf send trigger an event in my javascript when it start loading, starts playing and ends playing.</p>

<p>What is the best way to do that in Flash CS3 using Actionscript 3.0 ?</p>

[{'answer_id': 38515, 'author': 'David Crow', 'author_id': 2783, 'author_profile': 'https://Stackoverflow.com/users/2783', 'pm_score': 2, 'selected': False, 'text': '<p>A common way to do this is with the <strong>ExternalInterface</strong> class, which you can use to call JavaScript methods.</p>\n\n<p>First define your JavaScript methods, for example:</p>\n\n<pre><code>&lt;script language="JavaScript"&gt;\n    function startsPlaying()\n    {\n        // do something when the FLV starts playing\n    }\n&lt;/script&gt;\n</code></pre>\n\n<p>Then modify your ActionScript to call the JavaScript method at the appropriate time:</p>\n\n<pre><code>// inform JavaScript that the FLV has started playing\nExternalInterface.call("startsPlaying");\n</code></pre>\n\n<p>For more information, see the related Flash CS3 <a href="http://livedocs.adobe.com/flash/9.0/main/00000342.html" rel="nofollow noreferrer">documentation</a>.</p>\n'}, {'answer_id': 38529, 'author': 'Greg', 'author_id': 4123, 'author_profile': 'https://Stackoverflow.com/users/4123', 'pm_score': 4, 'selected': True, 'text': '<p>You need to use the "allowScriptAccess" flash variable in the HTML. You probably want to use "sameDomain" as the type. Note that if you go cross-domain, you also need to host a special file on the server called \'crossdomain.xml\' which enables such scripting (the flash player will check for this. More info at <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14213&amp;sliceId=2" rel="noreferrer">http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14213&amp;sliceId=2</a></p>\n\n<p>The call is the easy part. :-) In the Flash code, you\'ll use the ExternalInterface to do the call, as documented here:</p>\n\n<p><a href="http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&amp;file=00001655.html" rel="noreferrer">http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&amp;file=00001655.html</a></p>\n\n<p>Short version: you say </p>\n\n<blockquote>\n  <p>ExternalInterface.call("javascriptFunction", "argument")</p>\n</blockquote>\n'}, {'answer_id': 586560, 'author': 'Jon Romero', 'author_id': 42153, 'author_profile': 'https://Stackoverflow.com/users/42153', 'pm_score': 2, 'selected': False, 'text': '<p>if you don\'t want to load </p>\n\n<pre><code>import flash.external.*;\n</code></pre>\n\n<p>so you can also do a </p>\n\n<pre><code>getUrl("javascript:startsPlaying();");\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/38408', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4112/']