Mi problema es el siguiente, puedo establecer la conexión al archivo php, y enviarme datos simples, como por ejemplo un String, pero al momento de trabajar con objetosVO se me complicó, siempre me queda nulo
[url=http://depositfiles.com/files/yqy3q2uwz][/url]
Pongo los códigos tmb:
Código ActionScript :
package Eventos
{
import flash.events.Event;
import model.HolaVO;
public class lala extends Event
{
//.........................................Constants..........................................
public static const LEER_DATOS: String ="LeerDatos";
public static const GUARDAR: String = "Guardar";
public var pruebaHola: HolaVO;
//.........................................Constructor..........................................
public function lala(type:String, bubbles:Boolean=true, cancelable:Boolean=true)
{
super(type, bubbles, cancelable);
}
}
}Código Flex :
<?xml version="1.0" encoding="utf-8"?>
<EventMap xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="http://mate.asfusion.com/"
xmlns:Servicios="Servicios.*">
<mx:Script>
<![CDATA[
import com.asfusion.mate.core.*;
import Eventos.*;
import model.HolaVO;
]]>
</mx:Script>
<EventHandlers type="{lala.LEER_DATOS}">
<RemoteObjectInvoker id="myRemote" instance="{myService.HolaRO}" method="teDevuelvoUnHelloWorld" >
<!-- <resultHandlers>
<CallBack method="handleResult" arguments="{resultObject}"/>
</resultHandlers>
<faultHandlers>
<CallBack method="handleFault" arguments="{fault.faultDetail}"/>
</faultHandlers> -->
<resultHandlers>
<ServiceResponseAnnouncer type="result">
</ServiceResponseAnnouncer>
</resultHandlers>
<faultHandlers>
<ServiceResponseAnnouncer type="fault">
</ServiceResponseAnnouncer>
</faultHandlers>
</RemoteObjectInvoker>
</EventHandlers>
<!-- /////////////////////Services/////////////////////////// -->
<Servicios:Services id="myService"> </Servicios:Services>
</EventMap>Código Flex :
<mx:Object xmlns="http://mate.asfusion.com/" xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:RemoteObject id="HolaRO" showBusyCursor="true" destination="Hola" source="Hola" makeObjectsBindable="true"/> </mx:Object>
Código ActionScript :
package model
{
[Bindable]
[RemoteClass(alias='mode.HolaVO')]
public class HolaVO
{
public var hola: String;
public var mundo: String;
}
}Código Flex :
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300"
xmlns:mate="http://mate.asfusion.com/">
<mx:Script>
<![CDATA[
import Eventos.*;
import mx.controls.Alert;
import com.asfusion.mate.events.ResponseEvent;
import model.*;
//...........................................handleResult........................................
[Bindable] public var pruebaHola : HolaVO;
public function handleResult(text: ResponseEvent):void
{
//ti.text = event.result.toString();
Alert.show("FUNCIONAAAAAA: " + pruebaHola.hola );
}
//...........................................handleFault........................................
public function handleFault(text: ResponseEvent):void
{
Alert.show("No funcione: "+ text.fault);
}
//...........................................submitForm........................................
private function enviar():void
{
this.Despachador.generateEvent();
}
]]>
</mx:Script>
<mate:Dispatcher id="Despachador" generator="{lala}"
type="{lala.LEER_DATOS}">
<mate:ServiceResponseHandler result="handleResult(event)"
fault="handleFault(event)" />
<mate:eventProperties>
<mate:EventProperties pruebaHola="{pruebaHola}">
</mate:EventProperties>
</mate:eventProperties>
</mate:Dispatcher>
<mx:Button x="167" y="135" label="Button" click="enviar()"/>
</mx:Canvas>Y los php:
Código PHP :
<?php
require_once('./vo/HolaVO.php');
class Hola {
function teDevuelvoUnHelloWorld() {
$nuevo->hola = "Hello";
$nuevo->world = "World!";
return $nuevo;
}
}
<?php
class HolaVO
{
var $_explicitType = 'model.HolaVO';
public $hola;
public $mundo;
}
?>
