Comunidad de diseño web y desarrollo en internet online

AYUDA EN FLEX Cannot invoke method 'muestraProductosx'

Citar            
MensajeEscrito el 06 Nov 2009 06:20 am
holaaaaaa a todosss soy nuevito en este foro es mi primeraaa consultaaaa y espero que me entiendas :lol:

lo qe ando asiendo es una pagina en flex de compra y ventaa es un proyecto semestrall que debo entragar al final del semestre :P y ando super urjido por el tiempooo

mi problema ess: ESPERO QUE ME ENTIENDAN SOY nuevoo en FLEX

tengo UNA tabla en la base de datos que se llama PRODUCTOS

[img]http://l4c.me/fotos/shinodax/tabla[/img]

donde tengo tipo de productos hasta ahora como ven en la fotos tengo dos tipos ( 1 que es PERRO y 2 que es GATO )

lo que ise es tener 2 MENU PERRO Y GATOS donde tengo la siguiente codigo dentro del <Script>


Código ActionScript :

private function validar (dlgo:String):void{

         var escena:Sprite = Sprite (Application.application);
         switch(dlgo){
      
                    case "perro":
                var request:URLRequest= new URLRequest("http://localhost:8080/FlexTallerSiste/componentes/IndexPerro.html"); 
            navigateToURL(request,'_self');
                
                     rmtuu.Productoperros();    
                       break;
            
                case "gato":
             
                var request:URLRequest= new URLRequest("http://localhost:8080/FlexTallerSiste/componentes/IndexPerro.html"); 
            navigateToURL(request,'_self');
             
                      rmtuu.Productogatos();     
                  break;
                
                            Alert.show("Caso default","Titulo dafault");
             default:
          }
      }
         
                  





lo que llamo en JAVA al hacer cick en un menu rmtuu.Productoperros() o rmtuu.Productogatos()

es lo siguiente:

Código ActionScript :

public static  List<Productos> Productoperros(){
 
      int codfi=1;
      return  MundoServices.Productosx(codfi);
      
   }
   
public static  List<Productos> Productogatos(){
 
      int codfi=2;
      return  MundoServices.Productosx(codfi);
      
   }    



[b]despues llamo para retornar una lista consulta a la base de datos::


Código ActionScript :


public static  List<Productos> Productosx(int codfi){
      System.out.println("metodo get Productos en ProductosHome");
        
      List<Productos> list = new ArrayList<Productos>();
      ResultSet rs;
      String query = "SELECT * FROM productos Where tipo_pro='"+codfi+"'"; 
      System.out.println(query);
      Connection conn = DataBase.openConnect();
      try {
         Statement stmt = conn.createStatement();
         rs = stmt.executeQuery(query);
         while ( rs.next()){
            Productos pais = new Productos();
            pais.setId_producto(rs.getString("id_producto"));
            pais.setNombre_producto(rs.getString("nombre_producto"));
            pais.setDescripcion(rs.getString("descripcion"));
            pais.setPrecio(rs.getDouble("precio"));
            
            list.add(pais);
            System.out.println(pais.getId_producto()+"\t "+pais.getNombre_producto()+"\t "+pais.getDescripcion() +"\t "+pais.getPrecio() );
         }
         rs.close();
         stmt.close();
         conn.close();
      } catch (SQLException e) {
         e.printStackTrace();
      }
      return list;
      
      }



y luego desde FLEX llamo rmtuu.muestraProductosx.send() el codigo es:


Código ActionScript :

   public static  List<Productos> muestraProductosx(int codfi){
      
      System.out.println("metodo muestraProductos en MundoServices");
   
      
      return MundoServices.Productosx(codfi);
   }



ME SALE EL SIGUIENTEE ERROR Cannot invoke method 'muestraProductosx'. en consola me muestra pero no en la vista

esto es lo que tengo en flex



Código :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"  backgroundGradientAlphas="[0.85, 0.85]" backgroundGradientColors="[#5467F1, #B5CC3E]"  layout="absolute" xmlns:clases="clases.*" creationComplete="initData()" height="532" width="1162">
   
   <mx:Script>
      <![CDATA[
         import clases.Productos;
         import mx.controls.Alert;
          import mx.managers.PopUpManager;
            import mx.core.IFlexDisplayObject;
            import mx.containers.TitleWindow;
          import mx.collections.ArrayCollection;
          import componentes.Informacion;
         import mx.utils.ArrayUtil;
         
         private var arrayCollection:ArrayCollection;
         private var arrBusq:Array = ["nombrePro","numero_cotizacion"];
           [Bindable]
         var sFecha:String; 
          
          private function initData():void {
                        
                        rmtuu.muestraProductosx.send();          
                        rmtuu.muestraVector.send();

                                    }
          
             public function validar():void{
      var request:URLRequest= new URLRequest("http://localhost:8080/FlexTallerSiste/componentes/IndexPerro.html"); 
            navigateToURL(request,'_self');
         }
         
            public function numeroCoti():void{

         

            }
          
           private function buscar():void {
            rmtuu.muestraProductos.send();
                 }

          
         function mostrarDlg():void{
            //var doctypes:Array = ["*.as", "*.mxml", "*.swc"]
            //CREAMOS EL CONTENEDOR TitleWindow
            var helpWindow:Informacion = Informacion(PopUpManager.createPopUp(this,Informacion,true));
            // Agregar título en la barra de título
               helpWindow.title="Información del Producto";
               
            //pass.text="eee";
               // Dar un poco de transparencia
               helpWindow.setStyle("borderAlpha", 0.9);
            //busq.editable = false;
            helpWindow.arrBusq = this.arrBusq;
            
               // Add a close button.
               // To close the container, your must also handle the close event.
               helpWindow.showCloseButton=true;
         
         /*   var dlgDatosProfesor:dicta = new dicta();
            PopUpManager.addPopUp (dlgDatosProfesor, escena, true);
             PopUpManager.centerPopUp (dlgDatosProfesor);*/
             
         }      

           /* private function showLogin():void {
                // Create a non-modal TitleWindow container.
                var helpWindow:IFlexDisplayObject =
                    PopUpManager.createPopUp(this, MyLoginForm, false);
            }
         
         
         
         <mx:method name="muestraDocentes" result="rmt.muestraDocentes.send()">
         <mx:arguments>
            <pais>{objDocente}</pais>
         </mx:arguments>
      </mx:method>
                  
   </mx:RemoteObject>      
         
         */
      ]]>
   </mx:Script>
   
   <mx:RemoteObject id="rmtuu" destination="Producto" fault="Alert.show(event.fault.faultString, 'Error');">
   <mx:method name="mostrarP">
      <mx:arguments>
         
      </mx:arguments>
   </mx:method>   
 
  </mx:RemoteObject>
   
    <mx:Binding source="ArrayUtil.toArray(grillaDocentes.selectedItem)" destination="this.arrBusq"/>
    
    
    
    

    
   <mx:Canvas x="23.5" y="10" width="209" height="516" backgroundColor="#00BE2D" backgroundAlpha="0.26" id="canvas">
      <mx:Button x="27.5" y="50" label="Perros" id="baceptar" click="validar()" fillAlphas="[1.0, 1.0]" fillColors="[#D2FBCB, #D2DAF4]" width="154" height="31" themeColor="#0594EF"/>
      <mx:Button x="27.5" y="104" label="Gatos" id="baceptar0" click="validar()" fillAlphas="[1.0, 1.0]" fillColors="[#D2FBCB, #D2DAF4]" width="154" height="31" themeColor="#0594EF"/>
   </mx:Canvas>
   <mx:Canvas x="240.5" y="10" width="681" height="516" backgroundColor="#00BE2D" backgroundAlpha="0.26" id="canvas1">
      <mx:Image x="156" y="10" width="369" height="176" source="@Embed(source='/imagenes/top.swf')"/>
      <mx:DataGrid x="69.5" y="219" width="564" height="221" dataProvider="{rmtuu.muestraProductosx.lastResult}" id="grillaDocentes">
         <mx:columns>
            <mx:DataGridColumn   headerText="Id" dataField="id_producto"/>
            <mx:DataGridColumn headerText="Nombre" dataField="nombre_producto"/>
            
         </mx:columns>
      </mx:DataGrid>
   
      <mx:Button x="313" y="460" label="Seleccionar" click="mostrarDlg()"/>
      <mx:Label x="21" y="189" text="Seleccione Producto" width="278" fontFamily="Verdana" fontSize="13" fontWeight="bold"/>
      
   </mx:Canvas>
   <mx:Canvas x="929.5" y="10" width="209" height="516" backgroundColor="#00BE2D" backgroundAlpha="0.26" id="canvas0">
      <mx:List x="10" y="10" dataProvider="{ rmtuu.muestraVector.lastResult}" fontSize="9" height="191" width="189"></mx:List>
   </mx:Canvas>

</mx:Application>





ESPERO QUE ME PUEDAN AYUDARRRRRR PORFAA SE LOS PIDO E ESTADO HORAS Y HORAS INTENTANDO SOLUCIONAR ESPERO QUE ME ENTIENDAS SI NO ME ENTIENDEN LES PUEDO ENVIAR LO QUE E ECHOOO Y EL BACKAP DE LA BASE DE DATOS

AYUDAAAAAAAAAA


GRACIAS POR SU ATENCIOONN ESPERO SUS RESPUESTAAA XAU

Por shinodax

41 de clabLevel



 

firefox
Citar            
MensajeEscrito el 06 Nov 2009 10:47 am
Si no entiendo mal, el error es de Java, no de Flex

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 06 Nov 2009 06:17 pm
Cannot invoke method 'muestraProductosx' ese error me salee en FLEX

Por shinodax

41 de clabLevel



 

firefox
Citar            
MensajeEscrito el 06 Nov 2009 06:28 pm
Ok, estás usando el tag RemoteObject, es decir Flash Remoting con un back-end en Java ... no se bien aparte de OpenAMF (y lo que era JRun) como se implementa en Java, pero puedes uysar un proxy para ver como viene la info o que error te da Java, te recomiendo http://www.charlesproxy.com

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 06 Nov 2009 06:31 pm
En java llamo el siguiente codigo

public static List<Productos> muestraProductosx(int codfi){

System.out.println("metodo muestraProductos en MundoServices");

return MundoServices.Productosx(codfi);
}

donde retorno una variable entero "codfi" haciaa "Productox" , para usarlo en la consulta


public static List<Productos> Productosx(int codfi){
System.out.println("metodo get Productos en ProductosHome");

List<Productos> list = new ArrayList<Productos>();
ResultSet rs;
String query = "SELECT * FROM productos Where tipo_pro='"+codfi+"'";
System.out.println(query);
.
.
.
.
.

y en flex lo llamo de la siguiente forma

rmtuu.muestraProductosx.send();

Por shinodax

41 de clabLevel



 

firefox
Citar            
MensajeEscrito el 06 Nov 2009 08:22 pm
ok voy a descargar el charles proxy

graciass compadre

Por shinodax

41 de clabLevel



 

firefox
Citar            
MensajeEscrito el 06 Nov 2009 09:03 pm
ya lo descargue el problema es como usarlo estoy

usando Eclipse con FLEX

como hago para usar "charles proxy"

espero su respuesta gracias

Por shinodax

41 de clabLevel



 

firefox
Citar            
MensajeEscrito el 06 Nov 2009 09:09 pm
Simplemente visualiza tu aplicación en el navegador con Charles abierto, verás allí todos los paquetes
De todas formas si no estás usando ninguna librería de amf, entonces en vez de RemoteObject deberías usar HTTPService, que lee de la salida estandard de tu back-end (System.out.println en tu caso), igual tienes que formatear como pares de nombre/valor para que Flex lo entienda

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 06 Nov 2009 10:32 pm
:( oye compadreee tienes msn o te mando el mio para que me agreguez porfa [email protected]


gracias por tu tiempo compadree Jorge

Por shinodax

41 de clabLevel



 

firefox
Citar            
MensajeEscrito el 06 Nov 2009 10:32 pm
:( oye compadreee tienes msn o te mando el mio para que me agreguez porfa [email protected]


gracias por tu tiempo compadree Jorge avisamee si me agregaste porfaaa ......

Por shinodax

41 de clabLevel



 

firefox
Citar            
MensajeEscrito el 06 Nov 2009 11:15 pm
ahora estoy buscando otra solucion por otro lado, lo que estoy asiendo ahora es enviar un text con el valor numero "1" a JAVA para la consulta

tp.text =String(int(tp.text) + 1);

eso pero me sale el siguiente error :

Access of possibly undefined property text through a reference with static type mx.controls:Button.

este es el codigo del BUTTON:

<mx:Button x="11" y="22" text="{1}" label="Perros" id="tp" click="validar('perro')" fillAlphas="[1.0, 1.0]" fillColors="[#D2FBCB, #D2DAF4]" width="154" height="31" themeColor="#0594EF"/>


se que el error debido que tengo que usar otra erramienta en vez del BUTTON como el TextInput ,.. pero yo quiero usar el BUTTON

que puedo hacer ???????????????

espero su respuestaa grandemente gracias

Por shinodax

41 de clabLevel



 

firefox
Citar            
MensajeEscrito el 07 Nov 2009 12:28 pm

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 07 Nov 2009 04:20 pm
gracias Jorgee

pero ya encontre una solucion a mi problemaa xD

Por shinodax

41 de clabLevel



 

firefox
Citar            
MensajeEscrito el 03 Jun 2011 05:55 pm
estimado,

tengo el mismo problema
como se soluciona!?

favor tu ayuda?

Sdls.-
Ariel

Por asaf747

0 de clabLevel



 

msie8

 

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