El caso es que llevo todo el dia intentado adaptarlo a mi proyecto pero no hay forma. Les dejo el codigo:
Código :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ns1="*" backgroundGradientColors="[#ffffff, #f0f0f0]" backgroundGradientAlphas="[1, 1]" verticalScrollPolicy="auto" >
<mx:states>
<mx:State name="panel_error">
<mx:RemoveChild target="{linkbutton1}"/>
<mx:RemoveChild target="{label1}"/>
<mx:AddChild position="lastChild">
<mx:LinkButton label="www.ahorrardinero.es" click="navigateToURL(new URLRequest('http://www.ahorrardinero.es'),'_blank')" color="#0080ff" id="linkbutton0" bottom="68" right="158" width="145"/>
</mx:AddChild>
<mx:AddChild position="lastChild">
<mx:Label text="(c) 2007 Global Finanzas. Todos los derechos reservados" left="10" bottom="70" width="325" id="label0"/>
</mx:AddChild>
<mx:RemoveChild target="{panel_id}"/>
<mx:AddChild position="lastChild">
<mx:Panel width="422" height="225" layout="absolute" horizontalCenter="20" verticalCenter="-78.5" title="Error de conexión" fontFamily="Verdana" fontWeight="bold" cornerRadius="10" color="#000000" backgroundColor="#ffffff" id="panel_error" backgroundAlpha="1.0" alpha="1.0">
<mx:Label y="90" text="e-mail:" horizontalCenter="-113"/>
<mx:TextInput y="86" width="187" fontFamily="Verdana" horizontalCenter="13.5"/>
<mx:Button y="135" label="Aceptar" width="112" horizontalCenter="-126" id="button0" />
<mx:Button x="282" y="135" label="Volver atrás" click="atras()"/>
<mx:TextArea borderColor="#ffffff" x="10" y="10" width="382" height="72" color="#ff0000">
<mx:text>Se ha producido un error al intentar conectar al usuario. El login o clave no son correctos. Puede ingresar su e-mail para recibir los datos de acceso por correo, o bien puede volver a intentar conectarse mediante el botón "Volver atrás"</mx:text>
</mx:TextArea>
</mx:Panel>
</mx:AddChild>
</mx:State>
</mx:states>
<mx:Panel width="422" height="225" layout="absolute" horizontalCenter="20" verticalCenter="-78.5" title="Identificación de usuario" fontFamily="Verdana" fontWeight="bold" cornerRadius="10" color="#000000" backgroundColor="#ffffff" id="panel_id">
<mx:Label y="50" text="Login:" horizontalCenter="-113"/>
<mx:TextInput y="46" width="187" fontFamily="Verdana" horizontalCenter="13.5" id="login"/>
<mx:Label y="93" text="Clave:" horizontalCenter="-113"/>
<mx:TextInput y="89" width="187" fontFamily="Verdana" horizontalCenter="13.5" id="clave"/>
<mx:Button y="125" label="Aceptar" width="112" horizontalCenter="23.5" id="btnAceptar" click="onButtonPress(event);" />
</mx:Panel>
<mx:Image y="58" source="imagenes/Logo_Grande.gif" horizontalCenter="-17.5"/>
<mx:Label text="Extranet Global Finanzas" styleName="appTitle" fontSize="20" color="#c0c0c0" left="10" top="10" fontStyle="italic"/>
<mx:LinkButton label="www.ahorrardinero.es" click="navigateToURL(new URLRequest('http://www.ahorrardinero.es'),'_blank')" color="#0080ff" id="linkbutton1" bottom="10" right="158" width="145"/>
<mx:Label text="(C) {a.getFullYear()} Global Finanzas. Todos los derechos reservados" left="10" bottom="12" width="459" id="label1"/>
<!--
Usaremos el remoteObject para acceder a nuestro servicio en php. En "destination" ponemos el
id que hemos definido en remoting-config.xml. Ponemos el parámetro showBusyCursor en true para
que nos salga un relojito en el cursor mientras estamos esperando las operaciones.
-->
<mx:RemoteObject id="remoteObject" destination="misquerys" showBusyCursor="true">
<!--
Definimos listeners distintos result y el mismo de fault (error) para cada una de las funciones
de la clase de php. Los listeners se invocarán cuando se complete la función y devuelva un
resultado, event.result.
-->
<mx:method name="consulta" result="consulta_Result(event)" fault="onFault(event)"/>
</mx:RemoteObject>
<!--Funciones -->
<mx:Script>
<![CDATA[
//Importamos la clase ArrayCollection, que usaremos en el DataProvider.
import mx.collections.ArrayCollection;
//Importamos las clases para trabajar con los remoteObjects de WebOrb
import mx.rpc.remoting.*;
import mx.controls.*;
import mx.rpc.events.*
//Importamos los detectores de eventos
import flash.events.Event;
//
///////////////////////////////////////////////////////
import mx.controls.Alert; //Control "Alerta"
public var Alerta:Alert;
///////////////////////
[Bindable]
private var resultado:ArrayCollection
//Al ejecutarse una consulta...
private function consulta_Result(event:ResultEvent):void{
//rellenamos la variable resultado con los datos obtenidos en la consulta,
//tratando de convertirlos en un Array usando el operador "as".
resultado=new ArrayCollection(event.result as Array);
//Si hay al menos un registro...
if (event.result){
estadotxt.text="Consulta completada";
//Si no...
}else{
estadotxt.text="No hay registro que mostrar";
}
}
//
//Muestra el error al no poder ejecutarse alguna función
public static function onFault(event:FaultEvent):void
{
Alert.show(event.fault.faultString, 'Error');
}
//Esto pasará cada vez que se pusle un botón:
private function onButtonPress(event:Event):void{
remoteObject.dame_user(escape(login.text),escape(clave.text));
estadotxt.text="Consultando...";
}
////////// Volver atras para reintentar identificarse
public function atras():void{
currentState="";
}
//Año actual para mostrar en el copyright
public var a:Date=new Date();
///////////////
]]>
</mx:Script>
<mx:Text x="183" y="289" text="Text" id="estadotxt" width="323"/>
<!--Fin de las funciones-->
</mx:Application>
Al pulsar le boton "Aceptar", me llama a la funcion "onButtonPress" y nada mas, el texto "estadotxt" se queda "Consultando..."
Alguien sabe porque no funciona???
Mil gracias desde ya
