Moin!
Wie kann ich setInterval und clearInterval innerhalb des Prototypen einbinden? Meine Lösung klappt nicht. Fehlermeldung der Javascript-Konsole: "this.neuePosition is not a function".
Das, was du setInterval (oder setTimeout) als String übergibst, muß ein im Hauptprogramm ausführbarer Befehl sein. "this" ist dort nicht definiert.
this.aktiv = setInterval('this.neuePosition()',50); // START
In deinem Prototypen hast du "this", in setInterval nicht.
f01 = new fahrzeug("f01",10,10,"N");
//f01_aktiv = setInterval('f01.neuePosition()',50); // das funzt
Weil du ein absolutes Objekt angibst.
- Sven Rautenberg
--
"Love your nation - respect the others."
"Love your nation - respect the others."