Tag: Actionscript

I compiled open source Adobe Flex SDK 3.5.0.12683 on Windows the other day – and today did the same thing on my MacBook. Since the journey from source to jar file was rather convoluted, I decided to document all the steps. Also my steps differ a bit from the recommended steps.

First download the Open Source Flex SDK 3.5.0.12683. Do not be tempted to download the zipped file from the webpage. A much needed file, setup.sh, is not present in that particular package. Funny that. Instead use svn. To install svn just enter:

sudo port install subversion

Then create the directory you want to use for Flex and cd it. To checkout the SDK source type:

svn co http://opensource.adobe.com/svn/opensource/flex/sdk/tags/3.5.0.12683

After waiting for svn to finish you should now have all the source code. Next you’re ready for the editing of setup.sh. It’s located at the root of your downloaded SDK source. Open the file (I used aquamacs but you can use your favorite editor) and point the script in the right direction of your ANT_HOME folder and your JAVA_HOME folder. I keep the two environment variables in my .profile by the way.

If you don’t have Ant, you’ll need to download and install it as well. Ant on OS X 10.6.2 is easily installed like this. Finally save your changes of setup.sh.

Next tell the Terminal all about the required paths for the coming ant build by issuing this:

source setup.sh

Now you’re almost ready to run the ant build. But before you do, you have to make sure that the Flash tests at the end of the ant build work properly. They also look rather impressive, I might add, so it’s a bad thing to miss. For testing, the Flash Player’s mm.cfg file must have the following entries

ErrorReportingEnable=1
TraceOutputFileEnable=1

and a FlashPlayerTrust file must allow local SWFs to access local files.

To ensure this, copy the files from Adobes to-do. I had to use “/User/myuser/” instead of just “/” to get the tests to work without a security sandbox violation.

That’s it! The Terminal is ready for the ant build. Do a:

ant main checkintests

and watch the build fireworks. You now have a complete mxmlc open source environment. Use it to compile some SWFs.

I needed swfdump.jar on my Windows box today. Per default the file is not in the bin folder of Adobe Flex SDK 3.5.0.12683 – so I discovered that I had to build the file all the way from source. Since the journey from source to jar file was rather convoluted, I decided to document all the steps. Also my steps differ a bit from the recommended steps.

First download the Open Source Flex SDK 3.5.0.12683. Do not be tempted to download the zipped file from the webpage. A much needed file, setup.sh, is not present in that particular package. Funny that. Instead use svn (if you don’t have a command line edition of subversion, I recommend Sliksvn). Create the directory you want to use for Flex and cd it. To checkout the source type:

svn co http://opensource.adobe.com/svn/opensource/flex/sdk/tags/3.5.0.12683

After waiting for svn to finish you should now have all the source code. Next you need to install cygwin. Since you’re on a Windows box, you’ll need cygwin to run the setup.sh script. Can’t be done without it. So get cygwin setup.exe and do a standard installation. I installed nano as an easy editor as well.

Now you’re ready for the editing of setup.sh. It’s located at the root of your downloaded SDK source. Open the file (I used nano but you can use your favorite editor) and point the script in the right direction of your ANT_HOME folder and your JAVA_HOME folder. If you have neither, you’ll need to download and install Ant and Java SDK as well. Finally save your changes of setup.sh.

Next tell cygwin all about the required paths for the coming ant build by issuing this in cygwin:

source setup.sh

At this point I got an error: $’\r’: command not found. Apparently cygwin is getting halted by dos carriage returns in the script. But don’t worry. To remedy this, you issue the line:

dos2unix setup.sh

Now you’re almost ready to run the ant build. But before you do, you have to make sure that the Flash tests at the end of the ant build work properly. They also look rather impressive, I might add, so it’s a bad thing to miss. For testing, the Flash Player’s mm.cfg file must have the following entries

ErrorReportingEnable=1
TraceOutputFileEnable=1

and a FlashPlayerTrust file must allow local SWFs to access local files.

To ensure this, copy the files from Adobes to-do.

That’s it! The cygwin enviroment is ready for the ant build. Do a:

ant main checkintests

and watch the build fireworks. The swfdump.jar file is now to be found in the /lib folder. And as a benefit you also now have a complete mxmlc open source environment. You can use it to compile some SWFs.

Flex 4 Gumbo recipe

Finally got around to compile my current flex project using Flex “Gumbo” 4 SDK (beta 4.0.0.10485) – and was in for quite a shock.

First the Spark theme is a major change. And in my humble opinion not for the better. Frankly it kinda looks like the early Java Swing Metal theme. Ugly. Furthermore it’s supposed to be simple to use. Which sounds pretty good – until you realize that this means that most of your hard-earned styles no longer work at all. They are simply not there anymore. Plus I’ve got a few events that are not happining at all anymore.

Luckily the Halo theme is still a part of the new SDK. And you can still use it. You just have to add these parameters to the compiler:

-compatibility-version=3.3 -theme=${flexlib}/themes/Halo/halo.swc

The compatibility-version parameter is exactly what it sounds like: It guarantees compatibility against older versions.

But wait. With these parameters many of the advantages of using Flex 4 goes away. One of them is Spark. Because Spark is so much more than just a theme. It’s a new component and skinning architecture, that is way better at separating the view from the controller. So I guess, that I have to take a harder look at Gumbo. New namespaces and all. This is a good place to start for the migration: http://www.adobe.com/devnet/flex/articles/flex3and4_differences.html

Or this: http://www.artima.com/articles/flex_4_styling.html

But I definitely have find another way to skin Spark…

Flex and architecture

Since Design Patterns by Eric Gamma et. al. came out an extra layer of architecture and structure has been imposed on object-oriented programming, and various ways of incorporating the ideal design patterns have emerged over time. This applies to Flex and Actionscript as well: Two of these different flavours are called Cairngorm and PureMVC.

But sometimes, I’m just saying sometimes, especially when dabbling in small projects, the work and investment needed is simply too big. I just found a good post, that goes right to the heart of the Model – View – Controller design pattern. It really demonstrates that good architecture is possible without too much overhead.