Ant task to terminate Flash Player Debugger

I’ve just switched over to IntelliJ as my actionscript editor. The IDE is great, really fast with some great features. Check out the review over at Flash magazine.
They only recently introduced actionscript support so its still kind of light on customisation for developing with the Flash platform. One thing that was driving me nuts is that when you debug a swf it always opens in a new window. There is no close previous player or terminate process. However this easy enough to achieve with an Ant script. Add the following to your build script and then in the project debug configuration, choose run Ant script before launch.

<target name="closeDebugger">
		<exec executable="killall">
		    <arg line="-9 'Flash Player Debugger'" />

This will kill all the Flash Player’s that are open. Its pretty dirty but it works well. This is a unix command, so will only work on Mac or on a Pc with Cygwin installed.

Flash Catalyst project to SWC

Flash Catalyst. Its great isn’t it? Import your layout file and quickly create flex components. Catalyst exports a layout to a flex project file (FXP). In flash builder you can import this file as a new project. However I’ve found it is pretty tricky to import these new components into to an existing project because it requires alot of a refactoring or an additional source path.
I frequently use the export to swc feature within the Flash IDE to export my components into a flash builder project. It seemed strange that Adobe didn’t also include an export to swc feature in the latest flash builder. In order to export to a swc you need to use compc which is only accessible via the command line. Luckily you can use an ANT script to easily automate this task. If you don’t have ant installed for flash builder, follow the steps on this guide. Once installed you can use the script to below to build a SWC out of your flex skin project. You can then you this use this swc in other projects to apply the skin to existing components by using the skinClass property.

<project name="MySkin" default="compileSWC" basedir=".">
<property name="PROJECT_NAME" value="MySkin" />
<!-- change this line if your on a p.c. -->
<property name="FLEX_SDK" location="/Applications/Adobe Flash Builder 4/sdks/4.0.0/"/>
<property name="compc" location="${FLEX_SDK}/bin/compc"/>
<property name="mxmlc" location="${FLEX_SDK}/bin/mxmlc"/>
<property name="asdoc" location="${FLEX_SDK}/bin/asdoc"/>
<property name="SRC_DIR" location="src"/>
<property name="LIBS_DIR" location="libs"/>
<property name="RELEASE_DIR" location="bin-release/"/>
<property name="RELEASE_SWC" location="${RELEASE_DIR}/${PROJECT_NAME}.swc"/>
<property name="flashplayer" value="/SAFlashPlayer" />

<property name="FLEX_SDK_NAME" value="${FLEX_SDK}" />
	<target name="compileSWC">
					 <exec executable="${compc}">
					 	<arg line="-source-path '${SRC_DIR}' -library-path '${LIBS_DIR}' -target-player=10"  />
					 	<arg line="-output '${RELEASE_SWC}'" />
					 	<arg line="-is 'src'" />
					 	<arg line="-include-libraries 'libs'" />
					 	<arg line="-include-libraries '${FLEX_SDK}/frameworks/'" />
					 	<arg line="-include-libraries '${FLEX_SDK}/frameworks/libs/'" />
					 	<arg line="-include-libraries '${FLEX_SDK}/frameworks/locale/en_US/'" />