1 / 3
Caption Text
2 / 3
Caption Two
3 / 3
Caption Three margin testing

Saturday, May 23, 2009

Install AMFPHP on GoDaddy Hosting Site

I got all my information form the following 3 web pages, especially the first one:
1. Install the AMFPHP

First download the AMFPHP library, unzip it and then copy the amfphp folder to webserver. On my Linux hosting site this folder is
~/html/Sites/en.h.com/amfphp
and the URL is http://en.hycademy.com/amfphp. (delete the .htaccess file from this folder.) If everything is right, you will be able to test all the exposed PHP classes at: http://en.hycademy.com/amfphp/gateway.php

Then download StartingWithAMFPHP1.zip Use SQL script to generate tables in MySQL database. Extract all from PHP directory into AMFPHP service directory. In FLEX directory you can find a finished Flex project that you can import into your Flex workspace.

2. Create database

mysql -h dbname.dbhost.com -u username -p <amfphp.sql

3. Create PHP files
PHP service classes
~/Sites/en.h.com/amfphp/services/org/zgflex/cookbook/services/FlexAMFPHP.php
~/Sites/en.h.com/amfphp/services/org/zgflex/cookbook/services/SoccerManager.php
data objects
~/Sites/en.h.com/amfphp/services/org/zgflex/cookbook/dao/Player.php
~/Sites/en.h.com/amfphp/services/org/zgflex/cookbook/dao/Team.php

Please note, PHP script must have the same name as the class inside of it.

4. Create Flex project
Import the Flex project.

MXML application uses two remote objects, one is calling dummy PHP service and the other one works with the soccer data and helps you handle the data.

StartingWithAMFPHP.mxml

......

<mx:RemoteObject id="FlexAMFPHPService" source="org.zgflex.cookbook.services.FlexAMFPHP" destination="amfphp"
fault="faultHandler(event)" showBusyCursor="true">
<mx:method name="communicationTest" result="checkCommunicationHandler(event)" />
<mx:method name="checkAnotherMethod" result="checkCommunicationHandler(event)" />
</mx:RemoteObject>

<mx:RemoteObject id="SoccerService" source="org.zgflex.cookbook.services.SoccerManager" destination="amfphp"
fault="faultHandler(event)" showBusyCursor="true">
<mx:method name="getTeams" result="getTeamsHandler(event)" fault="faultHandler(event)" />
<mx:method name="updateTeam" result="updatedTeamHandler(event)" fault="faultHandler(event)" />
</mx:RemoteObject>

......

Just as you created PHP data class in Team.php, you need to create a simple mapping class in Actionscript. In this class you will store all the data and use it for handling data changes and sending the data back to the server. See Player.as and Team.as in Flex project folder: src/org/zgflex

You also need to configure services-config.xml file, and edit your URL to the AMFPHP gateway.php script.You have to use this XML file while the Flex project is compiled. You will do this by adding compiler parameter in project properties. Your compiler propetries should look something like this:

-locale en_US -services "services-config.xml"

Export the release build to bin-release folder and upload it to webserver's folder: ~/html/Sites/en.h.com/StartingWithAMFPHP/, and now you can access it at: http://en.hycademy.com/StartingWithAMFPHP/StartingWithAMFPHP.html

Working with Flex and PHP in Eclipse

From: Working with Flex and PHP in Eclipse | Adobe Developer Connection
By: Mihai Corlan

Developers who work with Flex and PHP can boost their productivity by combining two tools: Flex Builder and Zend Studio for Eclipse. This setup lets you create a combined project with Flex and PHP natures and reap the benefit of coding in both languages. (In Eclipse, natures link a project with specific builders and other settings.) The setup also enables you to debug your Flex and PHP code at the same time.

In this article I will show you how to install Flex Builder 3 together with Zend Studio for Eclipse, how to create a combined project, and how to debug a project that uses Zend AMF to send data between Flex and PHP.

Requirements

In order to make the most of this article, you need the following software and files:

Flex Builder 3 Eclipse Plug-in

Zend Studio for Eclipse

Zend Framework 1.7 or newer

Web server with support for PHP 5 or newer

Sample files:

  • flex_php.zip (ZIP, 445KB)
  • Note: You can import this archive using Import > Flex Builder > Flex Project.

Prerequisite knowledge

To benefit most from this article, it is best if you are familiar with Flex Builder, ActionScript 3.0, and PHP.

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

Featured Post

Windows和Ubuntu双系统完全独立的安装方法

http://www.ubuntuhome.com/windows-and-ubuntu-install.html  | Ubuntu Home Posted by Snow on 2012/06/25 安装Windows和Ubuntu双系统时,很多人喜欢先安装windows,然...