Using Amfphp 1.9 with the Adobe Flex 2 SDK
This article shows how you can make PHP interact with Adobe Flex. Adobe Flex is a technology to support the development and deployment of rich Internet applications based on their proprietary Macromedia Flash platform.
Requirements
The following is a list of the required libraries to run this tutorial. I recommand the you download all the files before starting the tutorial.
- Amfphp 1.9 beta 2 by Patrick Mineault
- Flex 2.01 SDK by Adobe
- Ant 1.7 by Apache
- Flex Ant Tasks on Adobe Labs
- commons-net-1.4.1.jar (required for FTP task)
- jakarta-oro-2.0.8.jar (required for FTP task)
Installation
Apache Ant
Extract the contents of apache-ant-1.7.0-bin.zip to your hard drive. We will refer to this location as [ANT_HOME]. Make sure you add [ANT_HOME]/bin to your system path.
Flex Ant Tasks
Extract the flexTasks.jar file from flex_ant_tasks_012307.zip into the [ANT_HOME]/lib directory.
Flex 2.01 SDK
NOTE: You must have an Adobe Account to download the Flex 2 SDK.
Extract the contents of flex_sdk_2.zip to your hard drive. We will refer to this location as [FLEX_SDK].
Project Workspace
Directory Structure
Choose a location on your hard drive to store your project. Create a new directory with the following directory structure. We will refer to this location as [PROJECT_HOME].
- build
- config
- flex
- docs
- api
- app
- dist
- lib
- flex
- php
- src
- flex
- php
- web
Amfphp
Installation
Extract the contents of the amfphp-1.9.beta.20070126.zip file into your [PROJECT_HOME]/src/php directory. We will refer to this location as [AMFPHP_HOME].
Before we can start using Amfphp we must first edit the gateway.php file located in the [AMFPHP_HOME] directory. Edit the charset setting. Select the charset appropriate for your language. In this case we will be using the English charset. Replace the original charset with the English one below.
$gateway->setCharsetHandler( "none", "ISO-8859-1", "ISO-8859-1" );
MySQL
Creating the Employee's table
This tutorial assumes that you are fimilar with basic MySQL administration. If you need assistance with MySQL please refer to the MySQL Documentation.
For this tutorial we will be using the test database that comes pre-installed with MySQL. Login to your MySQL server and selected the test database. Execute the SQL script below to create the Employee's table.
CREATE TABLE Employee (
empId bigint AUTO_INCREMENT NOT NULL,
firstName varchar(255),
lastName varchar(255),
phone varchar(255),
email varchar(255),
title varchar(255),
PRIMARY KEY(empId),
INDEX Employee_empId_INDEX (empId));