'da herhangi bir nesnenin yöntemini çağıramıyor Bu sınıfı tanımlamaya çalışıyorum ve daha sonra bunu başlatıp bazı yöntemlerini çağırıyorum.I Javascript
function Layer(){
this.image = null;
this.owned = false;
this.sim = false;
this.pos = 0.5;
this.vel = 0;
this.acc = 0;
this.lastup = millis();
this.newpos = 0;
this.scrub = scrub;
function scrub(npos){
this.newpos = npos;
this.vel = 0;
this.acc = 0;
}
}
dummy = new Layer();
dummy.scrub(0.8);
// chrome says Uncaught TypeError: Object #<an Object> has no method 'scrub'
Yöntemleri doğru tanımlarım mı?
this.scrub = bodur silmek; – Chris
'Millis' nerede tanımlandı? –
@Chris - bu hataya * sebep olur. –