Skip to content Skip to sidebar Skip to footer

Detecting When A Flash File Has Finished Playing In Javascript

I'm using Javascript to embed a flash file into a website which I then need to remove once it's completed playing. Is there a way to do this in plain Javascript? Or will it require

Solution 1:

Javascript has no native way to know when Flash is done playing. You can set a timer in javascript to remove it if the swf will always play for a set time or add an External Interface in flash to send a call to JS when its finished playing.

Add this in the last frame of the swf or in your destroy function:
import flash.external.ExternalInterface; if (ExternalInterface.available) ExternalInterface.call("JavaScriptFunctionNameToCallWhenDone", true);


Post a Comment for "Detecting When A Flash File Has Finished Playing In Javascript"