Comunidad de diseño web y desarrollo en internet online

Problemas con Claces Erencia e Instancias

Citar            
MensajeEscrito el 19 Oct 2011 04:42 pm
TEngo un problema tengo 3 claces.... LeerDatosAviso, AnularAvisos que estiende de LeerDatosAvisos y la tercera que no estiende de nada que es CambiarAviso.

El problema q tengo es que cuando creo una instancia de AnularAvisos y quiero detectar el evento anda correcto... pero cuando creo una instancia de LeerDatosAvisos no puedo hacer un Listener por no me aparece en la lista.. no se por que. Todo esto lo ago en la clace Cambiar Avisos.

Codigo de las 3 Claces:

Código ActionScript :

package Avisos
{
      //Importacion de librerias
      import flash.net.NetConnection;
      import flash.net.Responder;
      import flash.events.Event;
      import flash.events.EventDispatcher;

   public class LeerDatosAvisos extends EventDispatcher
   {

      //Objeto DATOS
      private var datos:Object;
      //Variables y Objetos de CONECXION
      private var gateway:String = "http://127.0.0.1/amfphp/gateway.php"; 
      private   var conexion:NetConnection = new NetConnection; 
      private   var responder:Responder = new Responder(exitos, error);; 

      
      //Constructor
      public function LeerDatosAvisos()
      {
         conexion.connect(gateway); 
         conexion.call("miClase.getAvisos", responder);
      }
      
      //Copio datos si conecta. Sino da Error
      private function exitos(datos:Object):void
      {
         this.datos = datos;
         this.dispatchEvent(new Event(Event.COMPLETE));
      }
      private function error(datos:Object):void
      {
         trace("Error: " + datos.description);   
      }
      
      //Metodo GET
      public function get Datos():Object{
         return this.datos
      }
   }
}



Código ActionScript :

package Avisos
{         
      //Importacion de librerias
      import flash.events.Event;
      import flash.events.EventDispatcher;
      import flash.net.NetConnection;
      import flash.net.Responder;
      
   public class AnularAviso extends LeerDatosAvisos
   {
      //Objeto DATOS
      private var datos:Object;
      //Variables y Objetos de CONECXION
      private var gateway:String = "http://127.0.0.1/amfphp/gateway.php"; 
      private   var conexion:NetConnection = new NetConnection; 
      private   var ejecutar:Responder = new Responder(exitos, error);

      
      //Contructor
      public function AnularAviso()
      {
         super();
         super.addEventListener(Event.COMPLETE,pasarObject);
      }

      private function pasarObject(e:Event):void
      {
         this.datos = e.target.Datos;
         Verificar();
      }
      
      private function Verificar():void
      {
         var hoy:Date = new Date();
         var fecha1:String;
         var fecha2:String;
         fecha1 = hoy.getDate() + "/" + (hoy.getMonth()+1) + "/" + hoy.getFullYear();
         
         for (var i:Number = 0; i <= int(datos.length - 1); i++) {
            trace(i);
            fecha2 = datos[i].vencimiento;
            trace(Date.parse(fecha1));
            trace(Date.parse(String(fecha2)));
            
            if (Date.parse(fecha1)== Date.parse(fecha2)){
               conexion.connect(gateway); 
               conexion.call("miClase.setAvisos", ejecutar,datos[i].id);
            }
         }
      }
         
      private function exitos(datos:Object):void
      {
         this.dispatchEvent(new Event(Event.COMPLETE));
         trace("se Ejecuto EXITOS");
      }
      
      private function error(datos:Object):void
      {
         trace("Error: " + datos.description);
      }
   }
}



Código ActionScript :

package Avisos
{
   import flash.events.Event;
   import flash.utils.Timer;
   public class CambiarAvisos
   {
      private var State:Boolean;
      private var Timer:Timer;
      private var Avisos:LeerDatosAvisos;
      private var ComprobarAvisos:AnularAviso;
      
      public function CambiarAvisos()
      {
         ComprobarAvisos = new AnularAviso();
         ComprobarAvisos.addEventListener(Event.COMPLETE,RecargarDatos);      
      }
   
      public function RecargarDatos(e:Event):void
      {
         Avisos = new LeerDatosAvisos();
         Avisos.addEventListener(Event.COMPLETE,Comenzar);      
      }
      
      public function Comenzar():void
      {
               
      }
   }
}


El error Esta en la funcion RecargarDatos. cuando ago Avisos.addEventListener no me error y dice que el metodo no esta definido....

Si ven algun otror error de concepto o programacion me gustarian que me lo señalen asi voy mejorando ...

saldudos...

Por kakinets

41 de clabLevel



 

msie
Citar            
MensajeEscrito el 19 Oct 2011 04:56 pm
Bueno perdon por crear tema por un error tan pavo de distraccion...
El problema es que Avisos es el nombre de package entonces no puedo poner un campo con el nombre Aviso:LeerDatosAvisos.... tengo q cambiar este ultimo...

igual acepto cualquier sugerencia y error que encuentren en estas 3 claces....

Saludos...

Por kakinets

41 de clabLevel



 

msie
Citar            
MensajeEscrito el 20 Oct 2011 04:11 pm
Escribir Herencia sin H Y Clases con C duele a los ojos, no mejorará tu código, pero si tu documentación

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 21 Oct 2011 02:40 am
Perdon, Esto es un problema que tengo... Desatencion y apuro se llama!!! Lo voy a corregir par mis proximos Post!!

Saludos...

Por kakinets

41 de clabLevel



 

msie

 

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