javascriptflashdom-eventsembedswfobject

How to listen for events with swfobject (like "onVideoEnded")


I am embedding a swf movie into my html with the static publishing method of swfobject:

<object id="swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="400" height="300">
    <param name="movie" value="some.swf" />
    <param name="play" value="false" />
    <param name="menu" value="true" />
    <param name="allowFullScreen" value="true" />
    <param name="loop" value="false" />
    <param name="FlashVars" value="javascriptCallbackFunction=onJavaScriptBridgeCreated" />
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="some.swf" width="400" height="300">
    <!--<![endif]-->
      <p><a href="http://www.adobe.com/go/getflash">
        <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
    </a></p>
    <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
  </object>

I want to trigger a Javascript function after the video had finished and tried with the above callback function in the flashvars parameter. My Javascript function looks like this:

function onJavaScriptBridgeCreated(playerId) {
var player = document.getElementById(playerId);
player.addEventListener("complete", "completeFunc");}

and

function completeFunc() {
alert('video ended');}

I found this approach at http://forums.adobe.com/thread/791624 and modified it for the static publishing method (http://code.google.com/p/swfobject/wiki/documentation).

But the problem is, the function completeFunc is never called and I can't figure out why.

I would be very glad if you could help me out.


Solution

  • i have solved this by using flowplayer. its very easy to use and offers sufficient configuration possibilities. thanks for your help anyway.