View Full Version : AMFPHP + Flex without Flash
maarek
09-24-2007, 06:51 PM
Hi.
I need to write data from Flex application into MySQL database. Is there an easiest way than using AMFPHP? I cannot install it. I have apache, PHP, MySQL and Flex Builder 2. I have not Flash. Can I build applications without havng Flash?
Thank you, Marek.
drkstr
09-24-2007, 11:54 PM
You most certainly can, but you need to grab amfphp-1.9 beta for it to work correctly. Here is an example of how I make a call to an amfphp function.
private const GATEWAY:String = 'http://localhost/amfphp/gateway.php';
//loads the listing details for the id passed as a parm and calls the responder when finished
public function getListingDetails( id:int ): void {
var gateway:NetConnection = new NetConnection( );
var responder:Responder = new Responder( handleListingDetailsResult, handleListingDetailsError );
gateway.connect(GATEWAY);
gateway.call( 'ListingProxy.getListingDetails', responder, myUser.userID, myUser.userHash, id );
}
private function handleListingDetailsResult( result:Object ): void {
trace('ListingManager.handleListingDetailsResult') ;
this.currentListing.setMemento(result);
dispatchEvent( new Event('propertyChange') );
}
private function handleListingDetailsError( result:Object ): void {
trace('ListingManager.handleListingDetailsError');
for( var p:String in result ) {
trace(p);
trace(result[p]);
}
}
You will need to import all the appropriate packages.
Best Regards,
...aaron
dr_zeus
09-25-2007, 05:50 PM
You don't need AMFPHP to write data to a database. Flex applications can send data to regular PHP scripts through POST, and the PHP can handle all the database connections.
drkstr
09-25-2007, 06:37 PM
Oops, I guess I misread the question. I thought you were asking how to use AMFPHP. dr_zeus is correct. Using the URLLoader class you can post form data (URLVariables) and have the PHP return an XML response.
Sorry for the mix up,
...aaron
maarek
09-28-2007, 05:25 PM
Thank you all.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.