7

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 name of the entry point class and I couldn't find anywhere to change it.

Anybody?

Amarghosh
  • 58,710
  • 11
  • 92
  • 121
gcstr
  • 1,466
  • 1
  • 21
  • 45

4 Answers4

3

Simply change the name of main app (.mxml) file name when you compile and make a build the swf is changed auomaticaly.

Tahir Alvi
  • 896
  • 2
  • 14
  • 44
2

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:

  1. use mxmlc to compile to ApplicationClass.swf
  2. command line copy ApplicationClass.swf to YourCustomSwf.swf
  3. command line run YourCustomSwf.swf

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-)

Sensei James
  • 2,617
  • 30
  • 36
1

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).

Amarghosh
  • 58,710
  • 11
  • 92
  • 121
  • Hey. I was stuck there too, trying to use the -output argument. Try to type the full path, it worked for me. – gcstr Sep 22 '09 at 21:04
  • hello, i get Option -output cannot be used when compiling in Flash Builder. i using Flash Builder 4.5 – ygaradon Jan 17 '13 at 18:33
1

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)

Pierre
  • 19
  • 1