Flex and Flare Installation (K)Ubuntu 8.10

Install Flex:

You’ll need Ant. I already had a JDK installed (java-6-openjdk).

sudo apt-get install ant

I installed Flex 3 stable. Download Flex from Adobe [NB: simply choose the "Free Adobe Flex 3 SDK." After spending too much time trying to get the "Open Source Flex SDK" to perform as expected, I gave up. The "Free Adobe Flex 3 SDK" includes all of the dependencies the OS Flex SDK is 1) missing (naturally) an 2) required for success.]

http://opensource.adobe.com/wiki/display/flexsdk/Downloads

I created a folder in my Home directory called “dv.” Starting with the “Free Adobe Flex 3 SDK,” unzip it into the dv directory.

unzip flex_sdk_3.2.0.3958.zip -d ~/dv/flex

[ N.B. If you use Ark to unzip the file, you may need to set the permissions for the executable files in the bin directory. You may also need to run the files through dos2unix. In this case, in the bin directory of your Flex installation, run this line: "for f in *; do if [[ $f != *.* ]]; then echo $f; dos2unix $f; fi; done;” If dos2unix is not installed, you can install it with this line: “sudo apt-get install tofrodos” ]

Now it is time to see if everything worked as expected. Go into the
“samples” directory and then the “explorer” directory.

cd ..
cd samples/explorer

Run the build.sh file. This will create a number of examples for perusal. It will also confirm that Flex is installed and working properly.

sh build.sh

If you open the explorer.html file in a browser after the lengthy build period, you should see a decent sampling of effects, complete with code, that can be rendered with Flex.

On to Flare:

Download Flare, which is in alpha at this stage, from: http://flare.prefuse.org/

And, like Flex, unpack it:

unzip prefuse.flare-alpha-20080808.zip -d ~/dv

Note, no special directory is required. The Flare developers kindly include all of the files in a directory. I did, however, rename the directory simply to “flare.”

Change into the “flare” directory. Before using Ant to build Flare, it is necessary to tell Flare where Flex resides. Therefore, open the build.xml file and, near the top of the file, define FLEX_HOME properly. Under FLEX_HOME, you will also need to properly define asdoc, which, since I use Linux, should point to the Linux executable and not the Windows executable.

<property name=“FLEX_HOME” value=“/home/USER/dv/flex/”/>
        <property name=“asdoc” value=“${FLEX_HOME}bin/asdoc”/>

In theory, it should work now, but it doesn’t. One get’s an error from Flex. After some searching, I located this bug report: http://bugs.adobe.com/jira/browse/SDK-14519. Evidently, effectively removing “xercesPatch.jar” from the FLEX_HOME/lib directory permits Ant to build the project correctly. Instead of making a change to the build.xml file, as suggested in the bug report, I simply renamed the file in the directory.

mv ~/dv/flex/lib/xercesPatch.jar ~/dv/flex/lib/xercesPatch.jar.bak

It remains to be seen what types of problems I shall experience because of this missing file. In any event, Flare will build now. From the “flare” directory, you can type:

ant all build

After “flare,” “demos,” and “tests” build successfully, you’ll get a “BUILD FAILED, Target ‘build’ does not exist in the project ‘flare’.” message. From everything I can see, it builds correctly and this can be ignored. You can also build the Flare documentation.

ant docs build

There are a few warning messages and, again, the “BUILD FAILED,” but it appears to be all intact at ~/dv/flare/docs/api.

Testing Flare:

Well, for starters, after building Flare, one can look in the flare/build directory for “flare.demos.swf.” If it exists and runs, it worked. But, to try something a little more adventurous and to set up the environment fully, let’s see if it is possible to build one of the examples from the Flare website.

For this, create a new directory, such as “flare_test” in the “dv” directory. I took the first complete block of code, which created a simple Sprite of a grey circle, from the Flare tutorials page. Copy the source code into a text file and save it as “Tutorial.as” in the flare_test directory.

Copy the flex-config.xml file from the /dv/flex/frameworks directory into the dv/flare_test directory. Rename the file, either after it is copied or during the process of copying it, so that it is distinctive from the original.

cp ~/dv/flex/frameworks/flex-config.xml ~/dv/flare_test/flex-config-flare-test.xml

Open the copied file in a text editor. Add “${flexlib}” (without quotes) at the beginning of all the file and directory paths under “external-library-path”, “library-path”, “namespaces” XML sections. For example, under “namespaces” the manifest element should now appear as

<manifest>${flexlib}/mxml-manifest.xml</manifest>

“${flexlib}” is a Flex variable that points to the Flex SDK installation.

It is also necessary to indicate where the Flare libraries are located. This is done in the “<source-path>” block. Uncomment the “<source-path> block, if necessary, and add two path elements:

<path-element>/home/USER/dv/flare/flare/src/</path-element>
        <path-element>/home/USER/dv/flare/flare/lib/</path-element>

From the command line, and within the flare_test directory, try to compile the Tutorial.as to a SWF file:

/home/USER/dv/flex/bin/mxmlc -load-config flex-config-flare-test.xml Tutorial.as

The “-load-config” option forces the compiler, mxmlc, to use the custom configuration file.

2 Responses to “Flex and Flare Installation (K)Ubuntu 8.10”

  1. Gianluca Says:

    Post really very useful.
    Thank you.

  2. donald Says:

    Excellent, just what I was looking for!
    Thanks for writing this down, very helpful

Leave a Reply

Enter this code

Entries (RSS)