Accessibility
Judah Frangipane

Judah Frangipane

www.drumbeatinsight.com

Pete Mackie

Pete Mackie

Seaquest Software

Table of Contents

Created:
16 February 2009
User Level:
Beginner, Intermediate
Products:
Flex

Flex quick start guide for HTML and PHP developers

As a web developer you may be wondering, "How do I start using Flex?" Adobe Flex is a very powerful set of tools but "...with great power comes great responsibility."

This article introduces you to Flex through basic examples and comparisons with HTML and PHP that you are already familiar with. Each section includes a stand-alone, working example that you can review. I'll begin with the basics like layout and then move on to more advanced topics such as form submission. The goal of this guide is to show you how easy it is to get started using Flex to build Rich Internet Applications.

Requirements

To make the most of this article, you need the following software and files:

Flex Builder 3

Sample files:

Table of Contents

Running the Flex/PHP code examples

The sample files contain a Flex Builder 3 archive project that includes all of the examples discussed in this article. You can import this project directly into Flex Builder or Eclipse (after installing the Flex Builder plug-in) by selecting File > Import > Flex Project and navigating to the file.

Open the project "src" directory to see the MXML files. Each of these MXML files, which are also called applications, can be run in a web browser. Right-click the file in the Flex Navigator (or the Package Explorer in Eclipse) and choose the option to "Run Application". MXML files differ from HTML files in that MXML files are compiled into a SWF file, which is then run from within an HTML page referencing the SWF file.

Flex Builder 3 automatically compiles the MXML code into a SWF file every time you save the file or the first time you choose "Run Application" from the Flex Builder menu. When you run the application, Flex Builder also automatically opens the application in the default browser on your system.

To specify the default application, right-click a file name and select the option to "Set as Default Application" from the context menu. The blue dot signifies the default application to run.

Note: The Flex Builder 3 project contains a folder of PHP files, which must be deployed to a PHP web application server (see the following instructions) in order to run the examples. Once the server is setup, described below, Flex Builder copies this folder to the web server when the project is built.

Deploying Flex examples on your local workstation web server

Follow the steps below to publish the PHP files to your local web server so that you can view them:

  1. If you do not already have a PHP-enabled web server installed, install XAMPP (for Windows) or MAMP (for Macintosh OS X).
  2. After installing the appropriate software linked above, start your local web server.
  3. In Flex Builder 3, choose Project > Properties. The Flex Builder 3 Project Properties window appears.
  4. Select the Flex Build Path tab. In the output folder, choose a directory on your localhost web server.
    1. On Windows, the path is:
      C:\XAMPP\xampp\htdocs or C:\XAMPP\xampp\htdocs\myproject
    2. On Mac, the path is:
      /Applications/MAMP/htdocs or /Applications/MAMP/projects/test
  5. In the Output folder URL field, enter the URL to the output folder.
    1. On Windows, enter: http://localhost/ or http://localhost/myproject
    2. On Mac, enter: http://localhost:8888 or http://localhost:8888/projects/test

After setting up the local web server, you can test your projects in Flex Builder and they will launch in the browser and run from the server (http://localhost) rather than the local file system (file://path/to/project/bin-debug/myproject.html).

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License

About the authors

Judah Frangipane is a designer/user experience developer who has worked in the web industry since 1996. During that time he has worked at Roxio, Parsons, and T8DESIGNS. He is currently working as a freelance consultant. He has been working with Flash since Flash MX and Flex 2 and has created and worked on numerous commercial Flex projects. He is currently working on a project that gives webmasters and designers the ability to add interactivity to a design without writing code. When not working Judah likes hiking, skiing and in general enjoying life.

Pete Mackie has been a software developer and publisher, first for ten years with a large corporation, and then founding his own company, Seaquest Software, some thirty years ago, which is still going strong. His recent development efforts were as a volunteer code committer for the Eclipse IDE and working on PHP-based web sites for small start-up companies. Pete stumbled upon Adobe's booth while attending EclipseCon 2006. Wondering what Adobe was doing at an open source centric conference, he stopped at the booth and discovered Flex Builder running on the Eclipse IDE. Pete instantly recognized what Flex could do for RIA client/server applications. Rushing home, he installed the Flex Builder 2 beta and has been hooked on Flex software development ever since.