At my work, we have to maintain a large and utterly horrible legacy project. You know the type. AS2, and not just any AS2 … nasty _global-infested, _root-ridden, procedural … like spaghetti when you forget to put a drop of olive oil in the water: tangled and stuck together. It’s far too big to redevelop the whole thing from scratch.
There are some small saving graces to this situation. It’s broken up into a “shell” SWF that loads in “component” SWFs (nothing to do with components in the Adobe sense, just SWFs that get loaded in, and follow an implicit interface - i.e. they all have an init() method). So in that sense, although there are a lot of dependencies, it should be possible to track them all down. My thought is that we replace the shell with a more maintainable set of AS3 objects, and provide an AS2 façade that manages all the legacy hideousness; to the components, everything is the same, but under the hood, it’s totally different.
I had a look at Grant Skinner’s SWFBridge and JumpEyeComponents’ ActionScript Bridge. Both provide a way of allowing AS2 and AS3 to talk to each other. With both, unfortunately, the communication is asynchronous; they use LocalConnection. That won’t fly in this scenario, without rewriting the components to listen for events and so on. There are too many components for that to be a realistic plan.
Does anyone know of a method to get AVM1 and AVM2 to talk to each other synchronously? A commentor on Grant Skinner’s blog post mentioned a project called “ASBridge” that does exactly that - using ExternalInterface as the underlying transport mechanism - but it doesn’t look like he’s released it.



Recent Comments