Hi there, i am new to php and specially AMFPHP, now all i am trying to do is send and Array to PHP using AMFPHP and get it back, but it returns “null”;.
here goes the AS3 code.
package
{
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class Main extends Sprite
{
private var gateway:String = "http://localhost/amfphp/gateway.php";
private var connection:NetConnection;
private var responder:Responder;
private var tags:Array = new Array();
public function Main ():void
{
trace ("AMFPHP Start....!");
responder = new Responder(onResult,onFault);
connection = new NetConnection();
connection.connect (gateway);
just_btn.addEventListener (MouseEvent.CLICK, doClick);
}
private function doClick (eve:MouseEvent):void
{
var tagData:Object = new Object();
tagData.title = "title01";
tagData.description = "asdfasdf";
tagData.destination = "http://www.yahoo.com";
tagData._x = 5;
tagData._y = 6;
tags.push (tagData);
//call the function in class
connection.call ("TestService.returnArray", responder,"tags");
}
private function onResult (result:Object):void
{
trace (result);
}
private function onFault (fault:Object):void
{
trace (String(fault.description));
}
}
}
and here goes the PHP Class which i am using…
<?php
class TestService
{
public function returnArray ($getArray) {
//$this->myArray = $this->getArray;
//$this->myArray = array ("abc","def","geh","ijk");
return $this->getArray;
}
}
?>