Ver Mensaje Individual
  #4 (permalink)  
Antiguo 20/01/2012, 17:52
Avatar de daPhyre
daPhyre
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: [email protected] (Redirects to 127.0.0.1)
Mensajes: 2.404
Antigüedad: 16 años, 2 meses
Puntos: 142
Respuesta: "Extensión" de clase

Sigo teniendo problemas... Tengo esta función:

Código PHP:
var ParticleSystem=new Array();
    
ParticleSystem.prototype.gravity=0;
    
ParticleSystem.prototype.wind=0;
    
    
ParticleSystem.prototype.moveParticles=function(){
        for(var 
i=0;i<this.length;++i){
            if (
this[i].age<this[i].maxAge){
                
this[i].x+=this[i].speed*(Math.cos(this[i].angle*(Math.PI/180)))+this.wind*this[i].age;
                
this[i].y+=this[i].speed*(Math.sin(this[i].angle*(Math.PI/180)))+this.gravity*this[i].age;
                
this[i].age++;
            }
            else 
this.splice(i,1);
        }
    } 
Sin embargo, parece que lo hago mal desde la declaración, ya que la consola de Javascript me lanza este error:

Cita:
Uncaught TypeError: Cannot set property 'gravity' of undefined
¿Me pueden dar una ayuda con esta misión?
__________________
<signs>daPhyre</signs>
Jugaa.me


Adios al dolor de cabeza de IE...