Comunidad de diseño web y desarrollo en internet online

HTTPService

Citar            
MensajeEscrito el 02 Mar 2009 02:20 pm
Amigos, les traigo una pregunta de principiante... en mi aplicación tengo en un state con un login en el cual llamo un php desde el HTTPService:
<mx:HTTPService id="login_user" result="checkLogin(event)" showBusyCursor="true" method="POST" url="http://localhost/site_admin/login.php" useProxy="false">
Ahora resulta que quiero llamar a otro php que carga unos datos en una grilla:
<mx:HTTPService id="prodRPC" url="http://localhost/site_admin/productos.php" resultFormat="e4x"/>
Cómo puedo hacer para meter todo el código en un solo HTTPService? cómo sería la forma correcta de hacerlo, ya que quiero usar varias llamadas a unos php. Gracias a todos por la ayuda. :)

Por xchacalx

Claber

133 de clabLevel



 

msie7
Citar            
MensajeEscrito el 02 Mar 2009 04:06 pm
Hola

Primero de todo, no utilices rutas absolutas en las llamadas a los php, utiliza rutas relativas... sino cuando tengas q subir los archivos al servidor vas a tner q cambiar eso por todos lados.

Bueno, con respecto a tu pregunta, no se puede hacer de forma directa porque tenes a cambiar tando la url como las funciones callback del result y del fault.

Entonces... hay 2 opciones, o creas 2 tags HTTPService o bien cambias de metodologia y lo haces por AS.

Código ActionScript :

var http:HTTPService = new HTTPService();
...
//en algun momento
http.url = "../productos.php";
http.addEventListener(ResultEvent.RESULT, onResult_1);
http.addEventListener(FatulEvent.FAULT, onFault_1);
...

// en algun otro lugar
http.url = "../login.php";
http.addEventListener(ResultEvent.RESULT, onResult_2);
http.addEventListener(FatulEvent.FAULT, onFault_2);



Considera q si utilizas el mismo httpService no podes hacer llamadas simultáneas.


Saludos!

Por alfathenus

833 de clabLevel

5 tutoriales

 

buenos aires || Argentina

firefox
Citar            
MensajeEscrito el 02 Mar 2009 05:54 pm
Gracias!!!!

Por xchacalx

Claber

133 de clabLevel



 

msie7

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.