Comunidad de diseño web y desarrollo en internet online

Usar 2 HTTPService en una misma aplicacion

Citar            
MensajeEscrito el 16 Sep 2009 06:53 pm
Hola amigos, tengo una app que emplea un HTTPService que lee un XML y llena un DataGrid. Todo OK!:

Código Flex :

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="service.send()" xmlns:local="*">

<mx:HTTPService id="service" url="industrias.xml" result="procesaXML(event)" fault="faultHanlder(event)"/>
<mx:Script>
   <![CDATA[ .....    ]]>
</mx:Script>
<mx:DataGrid id="datag" dataProvider="{ _resultado}" width="100%" height="100%" color="#333333" fontSize="11" borderStyle="solid"
               change="cambioGrid(event)" click="habilitame(event)">
               <mx:columns>
                  <mx:DataGridColumn dataField="id" headerText="#" width="5" />
                  <mx:DataGridColumn dataField="tipo" headerText="Categoria" width="15"/>
                  <mx:DataGridColumn dataField="nombre" headerText="Industria" width="80"/>
                  <mx:DataGridColumn dataField="licambiental" headerText="Licencian Ambiental" width="30"/>
                  <mx:DataGridColumn dataField="legal" headerText="Estado Legal" width="15"/>
                  
               </mx:columns>      
            </mx:DataGrid>
</mx:Application>


Ahora tengo un componente, que funciona de la misma forma pero carga otro XML, este no me funciona... ni ejecutandolo como componente incluido o aparte:

Código Flex :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="serviceMatrix.send()">
      <mx:Script>
      <![CDATA[
       import mx.rpc.events.FaultEvent;
        import mx.rpc.events.ResultEvent;  
      import mx.controls.Alert;
      import mx.collections.ArrayCollection;  
      
      [Bindable]
        public var _resultadoS:ArrayCollection = new ArrayCollection
                   
      public function procesaDosXML(event:ResultEvent):void{
         _resultadoS = event.result.prodea.industria;
      }        
         
      public function faultHanlderS(event:FaultEvent):void{
         Alert.show("Error:"+event.fault.faultString, "Alerta"+ event.fault.faultCode);
         
      }
   ]]>
</mx:Script>
   <mx:HTTPService id="serviceMatrix" url="matrix.xml" result="procesaDosXML(event)" fault="faultHanlderS(event)"/>
   
   <mx:DataGrid id="datag2" dataProvider="{ _resultadoS }" width="100%" height="100%" color="#333333" fontSize="11" borderStyle="solid">
               <mx:columns>
                  <mx:DataGridColumn dataField="id" headerText="#" width="5" />
                  <mx:DataGridColumn dataField="nombre" headerText="Nombre" width="15"/>
                  <mx:DataGridColumn dataField="pozo" headerText="Pozos" width="80"/>
                  <mx:DataGridColumn dataField="cant" headerText="Cantidad Pozos" width="30"/>
                  <mx:DataGridColumn dataField="inf" headerText="Informe Anual" width="15"/>
                  
               </mx:columns>      
   </mx:DataGrid>
</mx:Application>


Es posible usar dos httpservice en una misma aplicacion? uno carga el creationComplete en el mxml principal y el otro se carga en un componente... el primero funciona, pero el que esta embebido como componente, no me funciona.. que puedo estar haciendo mal? espero su ayuda graicas

Por gerick

9 de clabLevel



 

firefox
Citar            
MensajeEscrito el 17 Sep 2009 11:20 am
Ambos están dentro de un tag Application, entonces no pueden convivir ... si vas a hacer un componente personalizado, cambiale el tag, luego no hay problema que uses más de un HTTPService

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 18 Sep 2009 02:32 pm
Hola Jorge, gracias por responder, lo hice asi como me dices.. el componente personalizado como un VBox, y el creation complete en este tag, tampoco de esa forma me lee ambos httpservice.

Por gerick

9 de clabLevel



 

firefox
Citar            
MensajeEscrito el 18 Sep 2009 03:14 pm
Verifica que ambos creationComplete se disparen (agrega trace a ambos), luego que el resultHandler se dispare, ¿se dispara la llamada de ambos?

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox

 

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