Friday, January 12, 2007

Getting Started with Flex 2

After reading about Flex 2, I wanted to give it a try for myself. Adobe provides a free command-line compiler in the Flex SDK, downloadable with registration from their surprisingly clunky web site.

The download is just a zip file that you can extract and immediately begin using. Within a few minutes I was able to compile and test the sample applications, and from there it wasn't too hard to figure out the minimum setup I needed to create my own first application:

  1. Create an empty directory under the document root of your web server.
  2. Copy samples/explorer/AC_OETags.js to the new directory.
  3. Copy samples/explorer/explorer.html to the new directory. Rename it first.html
  4. Edit first.html and replace all instances of explorer with first
  5. Copy samples/explorer/build.sh to the new directory.
  6. Edit build.sh and change to the relative path to mxmlc so it points to wherever you extracted the SDK.

Once that was done, I created a new main layout file named first.mxml to declare my application:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
</mx:Application>

I used mxmlc to compile this into first.swf. I was then able to view first.html in a browser and successfully access my first (empty) Flex application.

No comments: