Listen for my Flash event in Javascript

后端 未结 3 680
醉话见心
醉话见心 2021-01-20 09:32

I\'m trying to build a basic video player with a playlist using the OVP Player. So far I have figured out how to feed in the new video source using ExternalInterface, but I

相关标签:
3条回答
  • 2021-01-20 10:06

    you can use SWF object project google
    http://code.google.com/p/swfobject/

    This library gives you the capability to listen events from actionscript to javascript and is very simple to use

    0 讨论(0)
  • 2021-01-20 10:15

    In the Model.as file find add this line in with all the other imports (at the start of the file):

    import flash.external.*;
    

    Then in the end event, add this line:

    ExternalInterface.call("stopedPlaying");
    

    So that an event would look like this:

            public function endOfItem():void {
                sendEvent(EVENT_END_OF_ITEM);
                // inform JavaScript that the FLV has stopped playing
                ExternalInterface.call("stoppedPlaying");
            }
    

    Then in your the HTML document, add this between SCRIPT tags:

    function stoppedPlaying()
    {
        // do something when the FLV starts playing
    };
    
    0 讨论(0)
  • 2021-01-20 10:19

    I think that externalInterface plugin for jQuery will make it relatively easy. If not then there's DOMEx class which looks promising. Code example from DOMEx site:

    if (ExternalInterface.available) ExternalInterface.call(javaScript, "Howdy Ya'll");
    [...]
    
    0 讨论(0)
提交回复
热议问题