Comunidad de diseño web y desarrollo en internet online

reutilizar httpservice para varios combos

Citar            
MensajeEscrito el 04 Jul 2008 06:39 pm
Saludos Sres.

Estoy intentando desarrollar en esta nueva herramienta que parece super pero me encontre con un pequeño inconveniente. en mi aplicacion tengo 1 combo y estoy utilizando httpservice, el cual se conecta con un jsp y este a su vez a java.. el cual me carga sin ningun inconveniente... pero me interesa colocar otro combo pero utilizar el mismo httpservice,y es cuando no puedo continuar ...intente asignandole el httpservice a una variable httpservice pero me carga los mismos valores los 2 combos..
si alguien pudiera darme una ayudita...
gracias..

Por joromarvil

1 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 04 Jul 2008 07:34 pm
Seguramente si te carga lo mismo en ambos es un tema de bindings (si lo has hecho via MXML) o de tu code si utilizas los callbacks del HTTPService.send

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 07 Jul 2008 04:52 pm

solisarg escribió:

Seguramente si te carga lo mismo en ambos es un tema de bindings (si lo has hecho via MXML) o de tu code si utilizas los callbacks del HTTPService.send

Jorge



lo que sucede estoy iniciandome en esto. y lo que me acabas de decir realment no lo
entiendo muy bien que se diga...

te envio elcodigo a ver si puede hecharme una mano:

-----------

Código :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
 backgroundColor="#FEFEFE" width="931" height="585" creationComplete="cargarCombosLoad()">
   <mx:Script>
      <![CDATA[
         import mx.collections.ArrayCollection;    
         import mx.rpc.events.ResultEvent;
         import mx.collections.XMLListCollection;
         
         import mx.rpc.events.FaultEvent;
         import mx.controls.Alert;
         
[Bindable]  private var params:Object = new Object();   
[Bindable]    private var aDatos:ArrayCollection ;
[Bindable]    private var aSexo:ArrayCollection ;         
[Bindable]
         private var servTipoIde:HTTPService =null;;
[Bindable]   private var servTratoPer:HTTPService =null;
[Bindable]   private var servSexo:HTTPService =null;      
         private var listData:XMLListCollection;
         private var origen:int;
         
         private var result:XML;
         
         private function cargarCombosLoad():void{
              servTipoIde=cargarCombos(1);
             servTratoPer=cargarCombos(4);
             
         }
         
         private function cambiar(numero:int):void{
            vs.selectedIndex=numero;
         }
           public function handleFault(event:FaultEvent):void
           {
              Alert.show(event.fault.faultString, "Error");               
           } 

         public function cargarCombos(origen_:int):HTTPService {
            origen= origen_;
            serviceDatosCombos.removeEventListener(ResultEvent.RESULT,insertItemHandler);
            serviceDatosCombos.addEventListener(ResultEvent.RESULT,resultHandler);
            serviceDatosCombos.method = "POST";
            params = {"origen":origen_, "datos": "o", "objeto": "u"}; 
            serviceDatosCombos.cancel();
            serviceDatosCombos.send(params); 
            return serviceDatosCombos;
 
         }      
         public function insertItemHandler(event:ResultEvent):void {   
             
         }
         
         public function resultHandler(event:ResultEvent):void {   
            var result1:Object = event.result;
             result = XML(event.result);  
             var xmlList:XMLList = result.data.children();   
            listData = new XMLListCollection(xmlList); 
 
             
         }                                 
      ]]>
   </mx:Script>
   
   <mx:HTTPService 
        id="serviceDatosCombos"
        url="src\jsp\personas_il.jsp"         
       fault="handleFault(event)"                
        resultFormat="e4x"
        useProxy="false"/>

         
       <mx:Move id="hideEffect" xTo="-500" />
       <mx:Move id="showEffect" xFrom="500" />
       

   <mx:Panel width="725" height="394" paddingTop="10" x="50" y="87" paddingLeft="30">
      <mx:Button label="Button" click="cargarCombosLoad()"/>
 
      <mx:ViewStack id="vs" 
         width="633" height="270" 
         selectedIndex="0" paddingLeft="30" borderStyle="none">
       
         <mx:Canvas backgroundColor="#FFFFCC" hideEffect="{hideEffect}" showEffect="{showEffect}">
            <mx:Label x="10" y="10" text="Tipo Identificacón:"/>
            <mx:Label x="252" y="10" text="Identificacón:"/>
            <mx:Label x="10" y="36" text="Apellidos:"/>
            <mx:Label x="252" y="36" text="Nombres:"/>
            <mx:Label x="10" y="62" text="Sexo:"/>
            <mx:Label x="252" y="62" text="Estado Civil:"/>
            <mx:Label x="252" y="88" text="Lugar de Nacimiento:"/>
            <mx:Label x="10" y="88" text="Fecha de Nacimiento:"/>
            <mx:Label x="10" y="114" text="Trato Persona:"/> 
                                                                               
            <mx:ComboBox x="127" y="60" width="102" editable="false" id="cmbSexo" ></mx:ComboBox>
            <mx:ComboBox x="127" y="8" width="102" editable="false"  id="cmbTiposIdentificacion"  dataProvider="{servTipoIde.lastResult.row}"  ></mx:ComboBox>
            <mx:ComboBox x="381" y="60" width="80" editable="false" id="cmbEstadosCivil" ></mx:ComboBox>
            <mx:ComboBox x="127" y="110" width="102" editable="false" id="cmbTrato"  dataProvider="{servTratoPer.lastResult.row}"></mx:ComboBox>
            <mx:TextInput x="351" y="8" width="110" id="txtIdentificacion0" maxChars="10" editable="true"/>
            <mx:TextInput x="99" y="34" width="130" id="txtIdentificacion1" maxChars="30" editable="true"/>
            <mx:TextInput x="351" y="34" width="110" id="txtIdentificacion2" maxChars="30" editable="true"/>
            <mx:TextInput x="384" y="86" width="147" id="txtIdentificacion3" maxChars="30" editable="true"/>
            <mx:DateField x="143" y="86" width="101" showToday="true"/>
         </mx:Canvas>
          
      </mx:ViewStack>
    
   </mx:Panel>
   <mx:Style source="archivos/estilos/estilos.css"/>
   <mx:TextArea id="forChange" width="150" x="10" y="48"/>
</mx:Application>

editado por eldervaz

Por joromarvil

1 de clabLevel



Genero:Masculino  

msie7
Citar            
MensajeEscrito el 07 Jul 2008 05:47 pm
Te falta darle formato a tu código

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.