hack33r.com

Using Apache Flex SDK without Flash Builder

Jul
29

Adobe Flash Builder costs money and (as far as I can tell) is basically just an eclipse plugin which calls into into the Apache Flex SDK. I used Flash Builder to get up to speed with what all is going in the Flash world these days. I had to sign up with for a trial when I installed it. The trial expired and I was left with a couple projects I was unable to access. This post describes the steps I took to build Flash Builder projects without Flash Builder. The solution decided to go with was to use the Apache Flex SDK and it’s Ant tasks.

The reason I’m looking into Flash in the first place is to get some streaming video and audio going. These days Adobe’s RTMP and RTMFP protocols are quickly becoming replace by open standards like WebRTC. For that reason, and because I generally shy away from IDEs,  I decided to forego the proprietary Adobe license and figure out how to build my projects using only the open source Apache Flex SDK. After starting down this path, I quickly realized there seems to be a standard way others do this using the Apache Ant build tool.

Installing the flex sdk on OSX consists of simply downloading the SKD’s zip file and extracting it to the folder of your choosing. There are probably several ways of installing the Apache Ant. I already use homebrew so choose to just run:

brew install ant

At this point all the dependencies needed required to compile a Adobe Flex Builder project without Flex Builder should be satisfied. Assuming the default project layout which should look something like this:


.
..
.actionScriptProperties
.flexProperties
.project
bin-debug
html-template
libs
src

 

The process of adding an Ant build if fairly simple. You’ll add build.properties and build.xml files to the root of the project. The build.properies file should define anything which might change in different build environments. In this this case, the location of the Flex SDK is something that will probably be different from one build machine to the next.

 


# change this to your Flex SDK directory path
FLEX_HOME=/Users/pokiecam/local/lib/flex_sdk_4.6/

# this points to your project's src directory
# {$basedir} is a default variable that can be used in any Ant
script
# and it points to the project's root folder [ flex_ant_pt1_Tasks ]
in this case
SRC_DIR =${basedir}/src

# points to the project's libs directory
LIBS_DIR =${basedir}/libs

# this is the folder we want to publish the swf to
DEPLOY_DIR = ${basedir}/bin-debug

 

The build.xml file contains the actual build instructions for Ant which are described as a series of steps similar to a Makefile but in fancy XML.

 

<project name="testClient" default="wrapper">
   <property file="build.properties" />
   <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar"/>
   <target name="init" depends="clean">
      <mkdir dir="${DEPLOY_DIR}" />
   </target>
   <target name="compile_swf" depends="init">
      <mxmlc file="${SRC_DIR}/testClient.mxml" output="${DEPLOY_DIR}/testClient.swf">
         <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
         <source-path path-element="${FLEX_HOME}/frameworks"/>
         <compiler.debug>false</compiler.debug>
      </mxmlc>
   </target>
   <target name="wrapper" depends="compile_swf">
        <html-wrapper title="testClient" file="testClient.html" height="100%" width="100%" application="app" swf="testClient" history="true" express-install="true" version-detection="true" output="${DEPLOY_DIR}"/>
    </target>
    <target name="clean">
      <delete dir="${DEPLOY_DIR}" />
    </target>
</project>

After this run ant and the build too will build the project.

I’ve created and example project on github to illustrate the process.

Installing Flash Builder on Mac OS Sierra

Jul
25

Installing Flash Builder Pro 4.7 on Mac OS Sierra 10.12.4

Here are a few notes about installing Flash Builder Pro on OSX. Adobe Flash Builder 4.7 software is a development environment for building games and applications using the ActionScript language and the open source Flex framework. Using Flash Builder can help you get up to speed with the latest from Adobe and Flex, however it does cost money. There are alternatives if you want to use Flex without paying for the flash builder license. If the license is an issue look at the open source Flex SDK.

#!/bin/sh
/MacOS/Adobe\ Flash\ Builder\ 4.7 -vm /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
  • Make the script executable: chmod +x /Applications/Adobe Flash Builder 4.7/runs.sh

You can now launch Flash Builder Pro via the run.sh script. 🙂

Welcome to my hacking adventures blog

Jul
25

Welcome to my hacking adventures blog. I’ll be posting some content soon.