Using ExternalInterface to change videos with video.Maru
November 15th, 2007 . by polyGeekWould you like to play Flash videos on your site and have links to play various different videos in your HTML code?
Here’s how to do it using the Flash player’s External Interface as a bridge between Javascript and Actionscript, which then uses the video.Maru API to switch videos.
Download source here, 1.2 megs with videos.
Here’s what the Actionscript code looks like:
Take a look at the first line of code: System.security.allowDomain(’http://videomaru.com/’). You’ll have to edit that to make it work on your machine. And give the System.security docs a read if you have any problems. I got everything to work by just opening the .htm file locally but that’s not always the case. Sometimes the ExternalInterface doesn’t work unless you are using a hosted file. I’ve wasted many an hour trying to debug when forgetting that little nugget.
And this is all there is to the Javascript:
