The Flex-Ajax Bridge is a wonderful little code library that completely opens up a swf to be controlled via JavaScript. Quoting the Flex-Ajax Bridge Labs page, “essentially anything you can do with ActionScript, you can do with JavaScript.” At least as far as I know, up until now this has been limited to use with the Flex framework and could not be used with a standard AS3 project.
With a recent project we worked on, we really didn’t need the entire Flex framework, but did however desperately want to use the capabilities of the Flex-Ajax Bridge. After a little digging in the framework code and a little more testing, we found out that its completely possible to use the Flex-Ajax Bridge with standard AS3 projects as well. Quite possibly the name should be changed to Flash-Ajax Bridge instead. We used this with the original FABridge source that was released quite a while ago, but right before posting this I tested it with the latest Flex Builder 3 Beta (which finally includes the code, so you don’t have to search random sites for it).
Note: I’m really not sure how this fits in with the EULA, so use at your own risk.
With the latest Flex Builder 3 Beta, copy the following sourcecode from the frameworks directory and paste them into your AS3 project source directory:
1) FABridge.as
from: /sdks/3.0.0/frameworks/javascript/fabridge/src/bridge/
to: bridge/
2) FABridge.js
from: /sdks/3.0.0/frameworks/javascript/fabridge/src/bridge/
to: your bin/js/ directory
3) IMXMLObject.as
from: /sdks/3.0.0/frameworks/projects/framework/src/mx/core/
to: mx/core/
4) Version.as
from: /sdks/3.0.0/frameworks/projects/framework/src/mx/core/
to: mx/core/
5) mx_internal.as
from: /sdks/3.0.0/frameworks/projects/framework/src/mx/core/
to: mx/core/
6) ItemPendingError.as
from: /sdks/3.0.0/frameworks/projects/framework/src/mx/collections/errors/
to: mx/collections/errors/
7) IResponder.as
from: /sdks/3.0.0/frameworks/projects/framework/src/mx/rpc/
to: mx/rpc/
Once you get those 6 classes and 1 js file into your AS3 project, you’re good to go!
To test, in your AS3 project base class create a new FABridge instance, then set the rootObject property of the instance to “this” (the base class reference). Give the bridgeName property of the instance a name and then in js you reference the flash bridge with that name, like the following: FABridge.[bridge name].root(). Now follow along to the tutorials on the Labs page.
That’s it… nothing to it.
Just remember, until we find out some more information regarding the EULA on this topic, use at your own risk.
I have to say Papervision3D really is great.
I’ve had my eye on it for a while but just never seemed to find the time to start playing around with it.
I actually come from a 3D background (which you can see if you go way back in my blog) but slowly found myself creeping into the Flash world and haven’t had a chance to look back. The opportunity to combine these two interests is hard to resist, but up until Papervision wasn’t very viable.
With the advent of Papervision3D 2 and Andy Zupko‘s effects addition, 3D in Flash is not only viable but seems to really be taking off.
When I heard there was going to be a Papervision class in NYC, I couldn’t pass it up. Since the class, I’ve been digging in and messing around and once Andy added his effects classes to SVN I jumped and started working on the lava rock at the top of the page.
Its basically a sphere primitive with a video texture applied to it.
I created a procedural texture in 3ds Max and applied it to a sphere primitive until I was happy with this:
Once I had the look I was happy with, I animated the texture. From there, I rendered out the texture as a flat series of images. I then created a Photoshop action that took the flat texture and created a seamless spherical texture. I then took the series of spherical images and created an flv. Once there, I applied that texture to the primitive sphere in Papervision.
To top it all off, I used some of Andy’s effect classes and created steam that seems to come from the actual cracks in the lava rock.
It took a little while to get it all setup and learn the ins and outs of Papervision, but now I’m hooked and can’t wait to keep messing around with it.