I am trying Flash Builder for the first time and I\'m stuck in a simple task. How can I change the output filename?
By default, Flash Builder gives the SWF the same
The -output argument will compile your swf in your FlashBuilder install directory (ex : -output myNewName.swf will output at C:/program files/Adobe/Flash Builder 4/myNewName.swf)
Simply change the name of main app (.mxml) file name when you compile and make a build the swf is changed auomaticaly.
Yeah, the "-output" compiler param won't work if you're compiling in Flash Builder, as you've no doubt realized. It's by design, believe or not (not sure why).
The solution that has worked for me has been to use a bit of indirection:
You can do this with either a simple (platform-dependent) build script, or with Flex Ant Tasks. I highly recommend the latter; it's easy to setup, integrates well with Flash Builder, and (as a mostly platform-independent solution) will work in a multi-team multi-OS environment. Here are the above steps as ant tasks that will perform the magic for you:
<project name="sample-build" default="run-your-swf">
<property file="${basedir}/your.properties.file"/>
<target name="compile-your-app">
<mxmlc file="${SOURCE_DIR}/ApplicationFile.mxml" compiler.debug="${IS_DEBUG}" incremental="true" failonerror="true">
<load-config filename="${DEFAULT_FLEX_CONFIG}"/>
<define name="CONFIG::DEBUG" value="${IS_DEBUG}"/>
<define name="CONFIG::FLASH_AUTHORING" value="${IS_FLASH_AUTHORING}"/>
<define name="CONFIG::IS_RELEASE" value="${IS_RELEASE}"/>
</mxmlc>
</target>
<target name="rename-your-swf" depends="compile-your-app">
<copy file="${OUTPUT_DIR}/feed/FeedComponent.swf" tofile="${OUTPUT_DIR}/YourNewSexyFilename.swf"/>
</target>
<target name="run-your-swf" depends="rename-your-swf">
<exec executable="${STANDALONE_FLASH_DEBUG_PLAYER}">
<arg line="${OUTPUT_DIR}/YourNewSexyFilename.swf"/>
</exec>
</target>
</project>
you need only define all ${VARIABLES} I've listed in "your.properties.file", like so:
FLASH_PLAYER_DEBUG=/Applications/Adobe Flash CS5/Players/Debug/Flash Player Debugger.app/Contents/MacOS/Flash Player Debugger
IS_DEBUG=true
(et cetera)
And anyway - what's in a name? A program by any other name, would be as awesome... B-)
Command line arguments for mxmlc are listed here and it seems that adding -output file.swf
to the additional compiler arguments field in Project|Properties|Flex Compiler is the way to go. But it didn't work for me (I am using FB3, but that shouldn't matter).