Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 24-12-2004, 10:05   #1 (permalink)
völlig unkreativ
 
Benutzerbild von creal
 
Registriert seit: Feb 2004
Beiträge: 27
Question 2 Prototypen aber nur einer funzt

Movieclip.prototype.scale = function(psx, psy, speed) {
var mc = this;
var xscale;
var yscale;

mc.onEnterFrame = function() {

if (Math.round((mc._xscale - psx)) == 0 and Math.round((mc._yscale - psy)) == 0) {
stop();
} else {
xscale = Math.round((psx - mc._xscale)) * speed;
mc._xscale += xscale;
yscale = Math.round((psy - mc._yscale)) * speed;
mc._yscale += yscale;
trace((mc._xscale - psx));
updateAfterEvent();

}

};
};
Movieclip.prototype.slide = function(tx, ty, spd) {
var mc = this;
var x;
var y;
mc.onEnterFrame = function() {
x = (tx - mc._x) * spd;
mc._x += x;
y = (ty - mc._y) * spd;
mc._y += y;
if (Math.round((mc._x - tx)) == 0 and Math.round((mc._y - ty)) == 0) {
}
updateAfterEvent();
};
};

Das sind meinen beiden Prototypen im 1. Frame.

Der Funktionsaufruf sieht so aus:
on (release) {
_root.cont.scale(30,30,0.3);
_root.cont.slide(140,330,0.5);}

Problem: Nur das was oben steht (hier "scale") wird ausgeführt. Der slide wird nicht abgearbeitet. Wieso nicht??
creal ist offline   Mit Zitat antworten
Alt 24-12-2004, 10:23   #2 (permalink)
mod_rewrite
 
Benutzerbild von sonar
 
Registriert seit: Feb 2003
Ort: München
Beiträge: 15.621
Die beiden oEF kommen sich in die Quere, da geht halt nur einer pro MC...
__________________
RTFM
Wie man Fragen richtig stellt.

Achim Bindannmalweg

Money makes the world go round, fear makes it turn much faster.
(New Model Army)
sonar ist offline   Mit Zitat antworten
Alt 24-12-2004, 11:15   #3 (permalink)
völlig unkreativ
 
Benutzerbild von creal
 
Registriert seit: Feb 2004
Beiträge: 27
Smile hmm

Sieht in der Tat so aus. Hast ne Idee wie ich das ändern könnte??
creal ist offline   Mit Zitat antworten
Alt 24-12-2004, 11:33   #4 (permalink)
mod_rewrite
 
Benutzerbild von sonar
 
Registriert seit: Feb 2003
Ort: München
Beiträge: 15.621
Ja, entweder beides in einen prototype packen oder mit setInterval arbeiten.

Übrigens steht da z.T. bissl Unfug drin:

stop(); is dazu gedacht, um in der Timeline anzuhalten, das bringt dir in ner Funktion nix (Funktion abbrechen: return(); )

updateAfterEvent() bringt hier auch nix, weil du ja eh einen onEnterFrame hast, d.h. es wird bei jedem Frame-Durchlauf aktualisiert. (updateAfterEvent() brauchst z.B. bei onMouseMove)
__________________
RTFM
Wie man Fragen richtig stellt.

Achim Bindannmalweg

Money makes the world go round, fear makes it turn much faster.
(New Model Army)
sonar ist offline   Mit Zitat antworten
Alt 24-12-2004, 20:11   #5 (permalink)
völlig unkreativ
 
Benutzerbild von creal
 
Registriert seit: Feb 2004
Beiträge: 27
Ok. Habs alles in einen Prototypen geschaufelt. Es geht jetzt. Dank dir.
creal ist offline   Mit Zitat antworten
Alt 24-12-2004, 21:48   #6 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
Aloa!
Du kannst Dir im übrigen die Referenz "var mc =this" sparen!
Kannst gleich this.onEnterFrame schreiben!!

Hi sonar
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 20:27 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele