Hi My workflow for working with Flash and Flex has turned into this:
Take one of two branches: Flex project or ActionScript project. I mostly start with a Flex project *but* I don't bother to use the Flex framework. I let it generate its usual main.mxml file that extends application. I then create my normal package structure in the src folder: com/[companyname]/[project]/ I create a class there that is the root class for my project - the class *must* extend Sprite or MovieClip. I then go back to the main.mxml and do the following change the mx namespace to: xmlns:[project]="com.[companyname].[project].[MainClass]" change the mx:Application tags to be [project]:[MainClass] remove any references like: layout="absolute" and so forth so your app tag is just <[project]:[MainClass] xmlns=".."> Now you have a "Flex project" that doesn't use the Flex framework but still has a single MXML file so the Flex compiler is happy. The MXML is non-graphical, can't use the design view with it and I don't add anything else to the MXML. Everything else happens in the as [MainClass] file. Once that is setup I create another folder: fla and if I don't already have a libs folder I create that and put in the appropriate references under Properties -> Flex Build Path -> Library Path. If the libs folder wasn't created by default, create it and use Add SWC Folder and point it to the libs folder. I make sure the libs folder is set to merge into code. Next I create one or more FLAs that will contain assets that I'll use in my final project. I make sure that I add the location of the src folder ../src/ in the class path for the FLA. I then create the appropriate Movie Clips and classes and associate them all together as needed and publish the FLA as both swf and as swc into the lib folder. I ignore the swf (it basically comes along for the ride). Now all the classes you created as MovieClips in Flash are available as classes in your flex project. The nice part is that when you compile in Flex, it will pull in the MovieClip class from the swc but it picks up the base class from your src folder so you never need to republish the swc except if the MovieClip symbol changes. Sometimes I need a "library" of symbols that I may or may not have actual code references to. Then I'll do one of two things: a) Create a class and list all the symbols as private static properties and then make a reference to that class in the [MainClass]. Keeping all the references neatly outside of my main class keeps things cleaner. b) I create a Flex Library project that I will treat as an RSL. This gets a bit interesting. Because the lack of the use of the Flex Framework means that any RSLs linked to the project will not automatically get loaded. You can solve that by loading them manually, or looking at the Flex SimpleApplication or Application classes and digging down and copying the RSL load scenerio. I do manually using XML config files to tell me what to load. The nice part is that you can still set them to auto-extract to deployment path and Flex will recompile the RSL and then extract the swf from it in debug or release form automatically for you. But again, you can't just point to the classes in the swc to include in the library, you have to create one class that lists all the MovieClips as static variables. So for example in both a) and b) you would do something like: import com.[companyname].[projectname].[SymbolName]; .... private static var _symbol1:Class = [SymbolName]; Flex will create the appropriate import statement and will show the swc classes in the prompts as you type so you can just do the last line and let Flex create the import statement for ya. Yes I actually create my symbol classes in package structure vs just [SymbolName] as the class in Flash. Sometimes I divide things up like: com.[companyname].[projectname].symbols.[SymbolName] (class associated with symbol in Flash) and com.[companyname].[projectname].[package].[BaseClass] (base class for MovieClip in Flash) Try not to name the two with identical names ie. try not creating a symbol called: CheckBox and a base class called CheckBox take it from me, this will drive you to drinking. I also load my RSLs into ApplicationDomain.currentDomain. After this code only changes and all debugging happens inside of Flex. Only time I open Flash is to publish a new swc *if* the symbols change or new symbols added (then of course need to make reference them in code). One additional cheat method you can use if you like for pulling in symbol assets: Create one master symbol, dump a copy of all the symbols you create into it, then you only have to reference that one symbol and you get all your other symbols for free. For games and such that I would have normally used the main FLA timeline for, I create a symbol that would represent that timeline and use it instead. I hate debugging in Flash itself (the Flex debugger is 10xs better for whatever reason that is I don't know - just easier to use, and at least in CS3 didn't crash as much). I've been told that the Flash debugger was based on the Flex debugger but for whatever reason the Flash team missed the boat on something because they don't work the same. Plus you might gain the use of the Flex profiler. The above workflow works for me, if you use Master symbols to pull in all the assets then you have a cleaner way that doesn't require as much effort to maintain. You don't have to create swcs for individual assets, just in the publish settings check the box that says create swc (it goes by the name of the swf and into the same folder and name). Flash needs to see the real classes when associating them with Symbols in the library but only the actual symbol gets pulled in *if* you use the same src folder in Flex Builder. Just *DO NOT* refer to anything in the Flex framework - this is for Game/Flash AS only development, the rules change big time the second you want to use anything in the Flex framework. But there is absolutely no way to update a Flash swf with new code from within Flex. You get close using the above and tweaking a bit. Sincerely Mark R. Jonkman

