Flash / JS Integration Kit Released Under an Open License

Mike blogged the news yesterday, but just in case you avoid his blog in favor of mine, I’ll blog the news, too. As you might have noticed from Kevin Lynch’s Flash Platform white paper, we recently released the Flash / JavaScript Integration Kit (beta). The kit allows you to call JavaScript functions from Flash, and to call ActionScript functions from JavaScript. Not only can you invoke functions seamlessly across environments, but you can also pass most data types back and forth, as well, such as:

  • Objects
  • Arrays
  • Strings
  • Numbers
  • Booleans
  • Dates
  • nulls
  • undefined

The Flash / JavaScript Integration Kit works across all major platforms and browsers, and is available over at osflash.org for free under an open license based on the Apache 1.1 software license. Here are all the important links:

Submit any bugs or feature requests at the development site. Check out the integration kit in action over at MXNA. And finally, if you build something cool with the kit, let me know.

11 Responses to Flash / JS Integration Kit Released Under an Open License

  1. this could provide a neat way to talk to an XML server from javascript without polling

  2. Stash says:

    What a load of crap, why dont your clearly specify that this dont work with Flash MX?

  3. Stash, the kit should work in any version of Flash where local connections are supported which is Flash Player 6 and higher, which means Flash MX should be fine. Check out the project’s homepage for this type of information before posting comments like this.

  4. the lack of return values seems kinda weak.

  5. Jared, couple of comments:1. It’s not possible to return values between the two environments, although we are considering adding “callback” functionality in the future.2. This is a beta, and we really wanted to make sure we had basic things like serialization working well before adding features. Callbacks are relatively simple to add — serialization between the two environments is not simple at all.3. There’s no reason why your AS or JS code can’t simply call a function in the opposing environment after receiving a call, essentially implementing callbacks manually. This is simple to do, and will work perfectly.4. This is an open source project, so if it doesn’t meet your needs, feel free to contribute features.

  6. Hi Christian,This is really cool, we’ll have to investigate to see how we’ll finally be able to use our exquisite JavaScript skills with the new Flash platform :)Are you coming to CFUnited or somth?Alexandru

  7. Dennis Crall says:

    Hello Christian,Nice work on the Flash/JS integration kit. It’s a useful little tool, and I have a couple questions and comments if you have time.1. I’m making a call to an ActionScript method from Javascript. JavaScriptFlashGateway.js/.swf are in the same directory as my .swf and .html file. The method is being called, but the parameter isn’t coming through.I’ve tried to add alert() statements in JavaScriptFlashGateway.js to see what’s going on, but they don’t execute. Any ideas?2. In your project documentation, you should move the section “Receiving a function call from JavaScript within Flash” to right after the section “Calling an ActionScript function from JavaScript”. It’s really confusing to interrupt the two.3. A bit off topic, is the technique of setting a Flash variable from JS deprecated? I found a bunch of old examples on the topic, but it would only work on Windows.Thanks.

  8. subHero says:

    Hello Christian,nice indeed!but it seems like the proxy-functionality accomplished by embedding the innerHtml-gateway-swf for every FlashProxy.call will get stuck if one hooks it up to continuously triggered javascript-events, in my case mousemove.can you copy that? or is it my lousy js-skills? or should i get on the mailing list for that? ;-)feedback would be nice…cheers-sh

  9. mike chambers says:

    >I’m making a call to an ActionScript method from Javascript. JavaScriptFlashGateway.js/.swf are in the same directory as my .swf and .html file. The method is being called, but the parameter isn’t coming through.It sounds like you have run into the issue described here:http://weblogs.macromedia.com/mesh/archives/2005/06/flash_javascrip_1.cfm#morewhich has been fixed (more info in that link).mike chambersmesh@macromedia.com

  10. mike says:

    There are a few pages which offer installation instructions and usage for this kit. But I must say in all honesty that all of them I’ve looked at give completely different instructions for the install.Apparently, some of the files in the download don’t need to be installed? They are just in the folders and subfolders and aren’t mentioned by Cantrell.Mustardlab, however, instructs to place each .js file into other places.Posting ONE (Correct) installation instruction would probably be best.

  11. tambi says:

    hi,can u give us a hint of how to use an fscommand function call for the AS to JS communication. I didnt know how to handle the calls. i tried setting the ID but i get errors.