« MSN Plays the Beta Game | Main | Cool Tool Friday: Google Launches Mobile Search »
June 15, 2005
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:
- Flash / JavaScript Integration Kit home page (get info and download the latest release).
- The project site (wiki and docs).
- The development site (hosted on Source Secure).
- The mailing list.
- The source tree (using Subversion -- very nice!).
- The Flash / JavaScript Integration Kit license.
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.
Posted by cantrell at June 15, 2005 11:16 PM | References
Related Entries
- Flash and Ajax: Happy Together
- Changes to the Flash / JavaScript Integration Kit
- JavaScript Flash Tag Update
- Search + Ajax = MXNA Suggest
- JavaScript Support for Eclipse
Comments
this could provide a neat way to talk to an XML server from javascript without polling
Posted by: jared chandler at June 16, 2005 12:38 AM
What a load of crap, why dont your clearly specify that this dont work with Flash MX?
Posted by: Stash at June 16, 2005 03:07 AM
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.
Posted by: Christian Cantrell at June 16, 2005 08:53 AM
the lack of return values seems kinda weak.
Posted by: jared chandler at June 16, 2005 09:51 AM
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.
Posted by: Christian Cantrell at June 16, 2005 10:05 AM
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
Posted by: Alexandru COSTIN at June 16, 2005 01:53 PM
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.
Posted by: Dennis Crall at June 23, 2005 08:23 AM
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
Posted by: subHero at June 23, 2005 09:53 AM
>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#more
which has been fixed (more info in that link).
mike chambers
mesh@macromedia.com
Posted by: mike chambers at June 23, 2005 10:09 AM
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.
Posted by: mike at June 23, 2005 07:32 PM
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.
Posted by: tambi at February 15, 2006 07:57 AM