Easy Flash/Flex collaboration

Having Flash and Flex folks working on the same project can get kind of weird. I’ve been experimenting with workflows that make it easy for the Flash people to do Flash, the Flex people to do Flex, and for both of them to play nice.

For instance, if you’re on a team composed of a designer (Flash CS3) and two developers (one using Flash, one using Flex 3), how do you bring over the designer’s Library assets into the Flex developer’s AS3 project without complicating the Flash developer’s workflow?

There’s a lot of ways to solve this, but this past week I’ve put together a utility class that simplifies your project. It’s called Syphon, and it works like this:
[LIST=1]
[]Your designer is charged with maintaining a “resource” FLA. All the assets in the Library that are important to the project need to be exported for ActionScript, and an instance of each asset must exist on the Stage.
[
]Syphon loads the resource file, gets the definition for each asset on the Stage, and using the name of that definition, assigns a property to a public “library” object. Syphon will accept any number of resource files.
[*]The Flex and Flash developers just need to pass the resource URL to the Syphon class, and listen for it to finish loading the definitions in. Every asset that the designer instantiated on the Stage of the resource file is accessible like this:
[/LIST]

private function proceed(event:Event):void {
	resetButton = new Syphon.library.ResetButton;
	loadButton = new Syphon.library.LoadButton;
	announcerLabel = new Syphon.library.AnnouncerLabel; // et cetera

Syphon works with any DisplayObject- which is what your designer should be working with anyway. Also, if the SWF has a font embedded in it, the designer just needs to export the font for ActionScript and stick its class name in a text box of any kind, and then stick it on the Stage. Syphon detects these text boxes and registers the corresponding fonts automatically.

It’s intended to be (a) a slim time saver and (b) a way to bring a familiar Flash developer concept- the Library- to non-Flash-specific workflows like Flex Builder. It doesn’t require putting any files in crazy parts of your Configuration directory or Embed tags or anything.

Also, as a contingency, if your designer has forgotten to drop an instance of some class “Clazz” onto the Stage of the resource file, the developers can still instruct Syphon to search for Class like so:

var myClass:Class = Syphon.getClass("Clazz");

This will also transfer the Clazz definiton to Syphon’s library.

You can grab Syphon here. Give it a shot- make two FLAs, export some Library assets for ActionScript in one and bring them over to the other. The underlying concept is nothing new, this is just an encapsulation. If anyone has any ideas for how to improve the class, I’m all ears.