Flex is an Adobe product which enables developers use an enterprise approach to add a rich interface to the web-based applications. It uses both an XML based syntax (the MXML) in order to describe the interfaces and various applications states and ActionScript to tie all of the actions together. You can find out a lot more on Flex from the Adobe website, or by searching for resources on the web.
When it comes to devloping Flex applications you can go about it several ways:
- Get the free SDK, the ActionScript VI syntax file and VIM and write your app at virtually no cost.
- Get the Flex Builder, install it separately or as a plugin to one of your Eclipse folders and use it to boost the developing speed.
As an extra step you can get the free Flex Data Services Express edition and use it in conjunction with an existing Java server (JRun, Tomcat, Jboss, you name it) and even have the mxml files compiled on the fly.
But how do you set up your work environment if you need to develop an enterprise J2EE application? You could use two different projects – one with your J2EE enabled Eclipse and one with the Flex Builder and intermix their location, or use manual sync – e.g. copy folders all day long – and two very separate projects. However there is a better way which allows you to use a single Eclipse and a single project for the entire applications. To set it up you will need:
- The latest Eclipse SDK. You can grab the latest, 3.2.1 SDK here.
- The Flex Builder. You can download a trial version here.
- Flex Data Services. You can download the free Express edition here.
- A Java server which can serve JSP’s and supports servlets. Tomcat does just fine, and you can get it here.
Now to set up the environment:
- First unzip the downloaded Eclipse SDK into a folder of choice. If you’re like me, you probably already have at least one Eclipse installed. You can simply create another folder.
- Open Eclipse. From the Help > Software Update > Find and Install check the Callisto Discovery Wweb Site and install the Web and J2EE plugins. Make sure you press the Select Required button to get everything it needs in order to work.
- When it finishes, start the Flex Builder installer. Make sure you check the option to install the Builder as a plugin to an existing Eclipse installation and supply the path to the recently created folder.
- After some time (it takes a while to unpack and install everything) you can start up Eclipse and check that the builder installed allright. You should have the option to create Flex projects in the New menu.
- Also install the Flex Data Services you downloaded and the Tomcat server.
- Now for the glue between them. There is a plugin on the Flex Exchange, formerly created by the Iteration Two guys which does just that – adds Flex nature to a Dynamic Web Project. Since the automatic update site does not work at the moment you can as well download the zip file here and unpack it in your Eclipse folder. Only unpack the features and plugin folders.
And this is it. Now you can define a regular Dynamic Web Project and you will have the option to use a Flex Data Services 2 Configuration. This will allow the server you pick in the runtime configuration to compile mxml’s on the fly. By switching to the Flex Development perspective you can also take advantage of the builder’s visual tools.
Happy coding!