Estoy con flex y php mediante webORB
En flex:
Con un textinput envio a una funcion una variable mediante un boton.
Tengo otro textinput para que reciba otra variable.
En php:
Una funcion que tiene variable de entrada un nombre y retorna ese mismo nombre para mostrarlo en flex.
Codigos:
Codigo Flex helloword.xml
Código :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
private function onResult(event:ResultEvent):void{
trace("<<>>",event.result)
}
private function onFault(event:FaultEvent):void{
trace("ERROR: ",event.fault.faultString)
}
private function nombre(name:TextInput):void{
salida.text=Service.login(name);
}
]]>
</mx:Script>
<mx:RemoteObject
id="Service"
destination="GenericDestination"
source="HelloWorld"
showBusyCursor="true"
result="onResult(event);"
fault="onFault(event);"
/>
<mx:Label x="33" y="20" text="Nombre:"/>
<mx:TextInput x="94" y="18" id="entrada"/>
<mx:Button x="276" y="18" label="Button" click="nombre(entrada)"/>
<mx:Label x="33" y="154" text="Su nombre es:"/>
<mx:TextInput x="124" y="152" id="salida"/>
</mx:Application>
Codigo Flex helloworld.php
(copie del tutorial, por eso hay helloworld, pero no lo estoy ocupando, es para conservar el nombre)
Código :
<?php
class HelloWorld
{
public function testMethod()
{
return 7;
}
public function helloWorld()
{
return "hello world";
}
public function login(string $usuario)
{
return $usuario;
}
}
?>Espero que me ayuden[/code]
