THE PASZ.COM BLOG

Sunday, June 17, 2007

Using FlexBuilder to Program for Flash CS3

This is probably completely obvious to some people, but there's a scarcity of information out there about Flash/Flex workflow, so I thought I'd post.

Here's the scenario:
You've been hired to work with a design company that only uses the Flash CS3; they have no interest in learning Flex. However, you don't want to program in Flash CS3 or some other text editor because you're comfortable with all the advanced features of FlexBuilder. You need to write code that can be compiled in both FlexBuilder and Flash CS3.

Fortunately this is easy to do:
In Flex create a new ActionScript Project with a Main class that extends Sprite. Create a new FLA in the same folder as your "Main.as" file. In Flash CS3, import and instantiate Main, and then call addChild() to attach the Main instance to your timeline. Here's the AS3 code for the first frame:


import Main;

var m: Main = new Main();
this.addChild(m);


Now you can publish your SWF from either FlexBuilder or Flash CS3!

16 Comments: