archivefeed

Beginning an Adobe Flex project on Linux

  • Download and unzip Flex to $HOME/flex

  • Add $HOME/flex/bin to your path

    $ cat ~/.bash_profile | grep flex
    export PATH=$HOME/flex/bin:$PATH;
  • Create a new directory for the Flex Project
    $ mkdir hello_flex
  • Edit HelloWorld.mxml
    <?xml version="1.0"?>
    <Application xmlns="http://www.adobe.com/2006/mxml">
      <Label text="Hello, world!" />
    </Application>
  • Create a build file – build.mxml. Change paths to reflect your own. I haven’t investigated how to use environmental variables in ant scripts, yet.
    <project name="HelloWorld" default="compile">
    <property name="flex.mxmlc" location="/home/pgowda/flex/bin/mxmlc" />
    <property name="dest.dir" value="bin" />
    <property name="media.dir"
        value="/home/pgowda/web_project/htdocs/media" />
    <target name="init">
      <delete dir="${dest.dir}" />
      <mkdir dir="${dest.dir}" />
    </target>
    <target name="compile" depends="init">
      <exec executable="${flex.mxmlc}" failonerror="true">
        <arg line="-output ${dest.dir}/HelloWorld.swf"/>
        <arg line="HelloWorld.mxml"/>
      </exec>
      <copy file="${dest.dir}/HelloWorld.swf"
        tofile="${media.dir}/HelloWorld.swf" />
    </target>
    </project>
  • Build the project
    $ ant 

    Buildfile: build.xml

    init:
       [delete] Deleting directory
       /home/pgowda/web_project/flexclient/bin
        [mkdir] Created dir:
       /home/pgowda/web_project/flexclient/bin
  
    compile:
         [exec] Loading configuration file
         /home/pgowda/flex/frameworks/flex-config.xml
         [exec]
         /home/pgowda/web_project/flexclient/bin/HelloWorld.swf
         (175845 bytes)
         [copy] Copying 1 file to
         /home/pgowda/web_project/htdocs/media

    BUILD SUCCESSFUL
    Total time: 6 seconds