Introducing the new, improved flash-javascript bridge!
Friday, March 23rd, 2007It's been a while. We got such great response from the post about our new <html/>, I thought it was time to do it again. In 4.0, the Flash embedding and Flash/browser communications subsystem has been rewritten from the ground up. What does this mean for you? You can now reliably communicate across the Flash/browser javascript boundary, sending as much data in either direction as you need. You can use DHTML to deliver your UI, and use Flash for things it's great for, like playing audio and video. Your applications can degrade gracefully for users that don't have the Flash player installed. More importantly, Flash apps can be more tightly integrated with the HTML pages they live in than ever before. I predict a new wave of innovative mashups that take advantage of the strengths of HTML and Flash, without relying entirely on either one.
Before I say more, please take a look at this example. Go ahead and click the 'Load' button, and you should hear some audio playing. What's the big deal? All the UI elements you're interacting with are DHTML, which is communicating with a tiny laszlo SWF audio player embedded on the same page. As the audio plays in the Flash app, it sends events to update the position of the play head in the DHTML app. Clicking buttons in the DHTML app sends events to the Flash application, affecting audio playback. It's a small example, but it shows off the feature pretty well.
One thing this example doesn't show is how much data you can pass across the boundary. I just ran a test, and on my machine I was able to pass 700K into Flash in 72 ms, and get 700k of data out of Flash in 50ms. Pretty snappy, huh?
All of this works across Firefox Safari and IE, for flash 7 and up.
And, you can take advantage of the improved history feature to make your applications interact with the browser forward and back buttons - with bookmarking and deep linking to boot!
Many thanks to our friends at Dojo foundation for their stellar contributions to the community, in particular Brad Neuberg, author of the awesome dojo.flash module which is the basis of the new feature.









