PDA

View Full Version : Flash Event Question


echochargen
12-23-2007, 03:50 AM
All -
I've never done anything in flash, just used swfobject to embed swf
files in my php/asp/html projects. Is there a way to fire a
javascript event when a swf file is finished playing?

I'd like to have a page with a training video embedded. When the
video ends, I'd like to use a javascript call to display a short form
where the user then marks that they've completed watching the video
and optionally comment on it.
My initial thought was that I'd have to do this inside the flash asset
with an actionscript(?) call to the javascript, but maybe I'm just
missing a simpler method.....

Thanks for any help.

Best Regards,
Jeremy

Gomfucius
12-23-2007, 07:43 AM
You should look into using the ExternalInterface class. You can communicate with the website using that.

This is from the help menu:

The ExternalInterface class is the External API, an application programming interface that enables straightforward communication between ActionScript and the Flash Player container– for example, an HTML page with JavaScript. Adobe recommends using ExternalInterface for all JavaScript-ActionScript communication.
You can call an ActionScript function in Flash Player, using JavaScript in the HTML page. The ActionScript function can return a value, and JavaScript receives it immediately as the return value of the call.