Running the Flex/PHP code (XAMPP, MAMP)

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).



  1. December 7th, 2009

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: