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.
After adding AS3 support to SyntaxHighlighter, I got hooked on it.
I offered to setup a forum at work, and after some time debating between phpBB and Vanilla, I decided upon the latest phpBB 3.
After getting it all setup, one of the most annoying things was how code blocks looked when posted. The default code block in phpBB allows for only php syntax. So I got to work on adding in SyntaxHighlighter.
It was surprisingly harder than I thought. I ended up having to manipulate some of the underlying php code of the forum to get it to function 100% (before doing that, the forum would always adjust the code to show up on one single line).
To make it easier for other people, I’ve created a phpBB SyntaxHighlighter mod.
As I said above, this was built for phpBB 3, not 2.
Please update me here or at the phpBB forum if you find any bugs or have any requests.