views:

33

answers:

3

Hello friends, I have the following array as3 example:

var arrayDefinitionsargsAmfPhp:Array = new Array();
arrayDefinitionsargsAmfPhp['tabela'] = "controls";
arrayDefinitionsargsAmfPhp['width'] = "100";

sending him to the remote object for php, example:

async = bridge.getOperation(amfphpFunction).send(arrayDefinitionsargsAmfPhp);

In php I try to get the array like this:

function retornamenu($tableInBd)
{

$arr = array($tableInBd);

$tableInBdname = $arr['tabela'];

$widthInBdname = $arr['width'];

But unfortunately these variables $tableInBdname and $widthInBdname not come to php, can someone help me with an example?

Thank already

A: 

You can send by sumbitting the values as URLVariables/ ..

var variables:URLVariables = new URLVariables();
variables.NAME = "Hello";
variables.EMAIL = "[email protected]"

var request:URLRequest = new URLRequest("sentFromFlex.php");
request.data = variables;
request.method = URLRequestMethod.POST;
sendToURL(urlrequest);

and in the PHP, you can get these variables in the $_POST array..

echo $_POST['NAME'];
echo $_POST['EMAIL'];
echo
hello friend, I'm using the method remote object RemoteObject () and is different, must be converted into the same array to php, someone else can help me?
luiz
A: 
[Bindable] public var rows2:Object = new Object();

Hold all the data in rows2 Object and dispatch it to PHP.

rows2=Application.application.whateverStuff;

<mate:eventProperties>
<mate:EventProperties rows2="{rows2}"/>  
</mate:eventProperties>

Now in the Event properties, you get the rows2 and which you send to PHP via Remoting.

    public function yourPHP($data)
     {
     //return print_r($data,true); 
     if(!$data || !is_array($data)|| !sizeof($data)){throw new Exception("No data sent.".(is_object($data)?"y":"n"));}
     //throw new Exception(print_r($data,true));
     array_shift($data);//get rid of the first row
     foreach($data as $row)
     {
           Now perform your manipulation here.

        }
}
A: 

Hello, the answer is ok, the solution is:

PHP

    function retornamenu($tableInBd)
{ 

$tableInBdname = $tableInBd['tabela'];

$mensagem = $tableInBd['mensagem'];

AS3

var arrayDefinitionsargsAmfPhp:Array = new Array();
arrayDefinitionsargsAmfPhp['tabela'] = "controls";
    arrayDefinitionsargsAmfPhp['mensagem'] = "este sao dados que vierem via array do as3";

async = bridge.getOperation(amfphpFunction).send(arrayDefinitionsargsAmfPhp);

thanks

luiz