Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listen for my Flash event in Javascript

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 can not figure out how to listen for the Flash event "EVENT_END_OF_ITEM".

How do I listen for Flash events in Javascript (and thus jQuery)?

OVP has a lot of events defined, but I don't know how to listen for them. For example, here is the EVENT_END_OF_ITEM:

public function endOfItem():void {
     sendEvent(EVENT_END_OF_ITEM);
}

The OVP documentation is non-existent and their support forum is almost as bad.

like image 898
Drew Baker Avatar asked Mar 05 '26 08:03

Drew Baker


1 Answers

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
};
like image 50
Drew Baker Avatar answered Mar 07 '26 22:03

Drew Baker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!