Flex workflow with concurrency

Hey there.

I'd like to know what is the workflow for enabling concurrency in Flash module. As we know, concurrecny is meant to be compiled into separate SWF and then embedded into primordial SWF. And, since the output folders are excluded automatically, I wonder how you guys do it. Is it ant/maven that copies files into the source folder for futher emdedding? Is it a separate module (but then, how you link common libs between modules)? This is quite hairy for me, as I can't get myself around it. I'm still new to IDEA, but in FDT you could configure eveyrhing to work any way you want. I could make a Build Configuration that would compile the SWF, and then make ant to copy it anywhere. But with IDEA, I can't find a way to compile without launching.

4 comments

1. How to make output folders visible in the Project View.

Output folder configured at Project Structure | Project is excluded and can't be unexcluded at the moment (tracked as IDEA-73141). Luckily each Flash build configuration (BC) has its own 'Output folder' setting. So you may keep standard output folder named 'out' and use folder like 'bin-debug' for the main app swf and 'workerswfs' for worker swf files. Other option is to change output folder configured at Project Structure | Project to any unexistent folder like 'out1' (and close/open the project after that). After that you'll be able to see your Flash output folders in the Project View.

2. How to configure ActionScript workers.

For each worker you need to configure a separate Flash BC with Output type: Application. (Truly speaking Output type: Runtime-Loaded Module will work as well, but the sense of Worker seems to be closer to App than to RLM). Note that each BC can have its own output folder, so you may place worker SWFs in a different folder than the main SWF.

3. How to reference worker SWF from code.

You don't need to copy files into the source folder for futher emdedding. Just write a relative path to it. For example:

[Embed(source="../../out/production/SomeModule/Worker1.swf", mimeType="application/octet-stream")]
private static var Worker1Class:Class;

or

[Embed(source="../workerswfs/Worker1.swf", mimeType="application/octet-stream")]
private static var Worker1Class:Class;

Note that if the worker SWF is placed in the excluded folder (i.e. you didn't follow recommendations at #1) then reference to Worker1.swf will be highlighted red, but compilation wil succeed.

Also before the first compilation of worker swf reference to the swf is highlightd red, just because the SWF file doesn't exist yet.

4. Compilation order.

Obviously, embedded SWFs must be compiled before the SWF that embeds it. To guarantee this you need to configure dependency of App BC on Worker BCs (see Dependencies tab of the App BC, Project Structure dialog). Note that this works only since IntelliJ IDEA 12.1.

5. Debugging of workers does not work.

You'll see [trace] statements both from the main app and from workers, but breakpoints in workers code won't work. Tracked as IDEA-97484.

Note that you need to use AIR SDK distribution that contains ActionScript Compiler 2.0 (default distribution), or you need to overlay this AIR SDK on top of Flex SDK. Using AIR SDK distribution that does not contain ASC 2.0 will prevent workers from execution in debug mode.

0

Problem with compilation order is fixed in today's IntelliJ IDEA 12.1 Release Candidate. I have updated #4 in my previous message.

0

Alex, thank you very much. I will make sure you get a bonus for help and effort given! However, I'm ill now and will check the guidelenes next week. Thank you, happy Easter.

0

Please sign in to leave a comment.