Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 09-02-2006, 20:35   #1 (permalink)
Neuer User
 
Registriert seit: Aug 2003
Ort: Switzerland
Beiträge: 72
move prototype

PHP-Code:
MovieClip.prototype.tomove = function(yposxposspeed) {
    
this.onEnterFrame = function() {
        if ((
this._x == xpos) && (this._y == ypos)) {
            
this._x this.xx
            this
._y this.yy
            delete this
.onEnterFrame();
        }
        if (
this.rewinds == true) {
            
this.shine.prevFrame();
        } else {
            
this.shine.nextFrame();
        }
        
this._y this._y+(Math.ceil(ypos)-Math.ceil(this._y))/speed;
        if (
Math.ceil(this._y) == Math.ceil(ypos)) {
            
this._y ypos;
        }
        
trace(ypos);
        
trace(this._y);
        
this._x this._x+(Math.ceil(xpos)-Math.ceil(this._x))/speed;
        if (
Math.ceil(this._x) == Math.ceil(xpos)) {
            
this._x xpos;
        }
        
    };
}; 
hmm weiss einer wieso das delete this.onEnterFrame nicht funktioniert bzw. probleme macht? irgendwie funzt das nciht
arniegeddon ist offline   Mit Zitat antworten
Alt 09-02-2006, 22:22   #2 (permalink)
All-rounder
 
Benutzerbild von thebiz
 
Registriert seit: Mar 2004
Ort: Bayerische Rhön
Beiträge: 2.507
Hast Du geprüft, ob xpos und ypos
auch wirklich erreicht werden?
__________________

--------------------------------
Ich klicke, ergo bin ich. (me)
--------------------------------
thebiz ist offline   Mit Zitat antworten
Alt 09-02-2006, 22:31   #3 (permalink)
Neuer User
 
Registriert seit: Aug 2003
Ort: Switzerland
Beiträge: 72
hm ja das ganze geht. wird erreicht. wen ich halt das delete this.onEnterFrame rausnehme dan funktioniert das ganze. wen ichs reinmach gibts ne Rekursion.

Geändert von arniegeddon (09-02-2006 um 22:32 Uhr)
arniegeddon ist offline   Mit Zitat antworten
Alt 09-02-2006, 22:45   #4 (permalink)
All-rounder
 
Benutzerbild von thebiz
 
Registriert seit: Mar 2004
Ort: Bayerische Rhön
Beiträge: 2.507
Was ist this.xx?
__________________

--------------------------------
Ich klicke, ergo bin ich. (me)
--------------------------------
thebiz ist offline   Mit Zitat antworten
Alt 09-02-2006, 22:57   #5 (permalink)
Neuer User
 
Registriert seit: Aug 2003
Ort: Switzerland
Beiträge: 72
this.xx ist die anfangsposition. setze ich anfangs wen der mc geladen wird

mc.xx = _root.mb["disc"+i]._x;
mc.yy = _root.mb["disc"+i]._y;

bei trace gibt der mir immer die position wo der movieclip in die bühne gesetzt wurde raus.
darf ich den ein delete in einer onEnterFrame funktion machen ?
arniegeddon ist offline   Mit Zitat antworten
Alt 09-02-2006, 23:11   #6 (permalink)
All-rounder
 
Benutzerbild von thebiz
 
Registriert seit: Mar 2004
Ort: Bayerische Rhön
Beiträge: 2.507
delete onEnterFrame ist schon in Ordnung im onEnterFrame.
__________________

--------------------------------
Ich klicke, ergo bin ich. (me)
--------------------------------
thebiz ist offline   Mit Zitat antworten
Alt 09-02-2006, 23:19   #7 (permalink)
Neuer User
 
Registriert seit: Aug 2003
Ort: Switzerland
Beiträge: 72
danke für deine hilfe... hm hab hier noch gekürzten code mal
so gehts:

PHP-Code:
MovieClip.prototype.tomove = function(yposxposspeed) {
    
this.onEnterFrame = function() {
        
this._y this._y+(Math.ceil(ypos)-Math.ceil(this._y))/speed;
        
        
trace(ypos);
        
trace(this._y);
        
this._x this._x+(Math.ceil(xpos)-Math.ceil(this._x))/speed;
        if (
Math.ceil(this._x) == Math.ceil(xpos)) {
            
            
removeMovieClip(this);
        }
    };
}; 
wen ich aber removeMovieClip(this); in delete this.onEnterFrame(); mach stopts mir dan die swf.

Geändert von arniegeddon (09-02-2006 um 23:20 Uhr)
arniegeddon ist offline   Mit Zitat antworten
Alt 09-02-2006, 23:19   #8 (permalink)
All-rounder
 
Benutzerbild von thebiz
 
Registriert seit: Mar 2004
Ort: Bayerische Rhön
Beiträge: 2.507
Schau mal ob Du die Bewegung nicht eher so machen willst.

PHP-Code:
MovieClip.prototype.tomove = function(yposxposspeed) {
    
this.onEnterFrame = function() {
        
this._x += (xpos this._x) / speed;
        
this._y += (ypos this._y) / speed;
        if (
this._x == xpos && this._y == ypos) {
            
delete this.onEnterFrame;
        }
    };
}; 
__________________

--------------------------------
Ich klicke, ergo bin ich. (me)
--------------------------------

Geändert von thebiz (09-02-2006 um 23:23 Uhr)
thebiz ist offline   Mit Zitat antworten
Alt 10-02-2006, 00:01   #9 (permalink)
Neuer User
 
Registriert seit: Aug 2003
Ort: Switzerland
Beiträge: 72
jou geht! hab noch grad was bemerkt.. mit klammern ruf ich das imemr wieder auf anscheinend ohne klammern nich. also this.onEnterFrame; hat dan auch mein 2ter prototyp gefixt

fettes mersi
arniegeddon ist offline   Mit Zitat antworten
Alt 10-02-2006, 00:56   #10 (permalink)
All-rounder
 
Benutzerbild von thebiz
 
Registriert seit: Mar 2004
Ort: Bayerische Rhön
Beiträge: 2.507
Oh, stimmt ist mir bei Dir garnicht aufgefallen.

Die Klammern dürfen da natürlich nicht hin.
__________________

--------------------------------
Ich klicke, ergo bin ich. (me)
--------------------------------
thebiz ist offline   Mit Zitat antworten
Alt 10-02-2006, 02:45   #11 (permalink)
Neuer User
 
Registriert seit: Aug 2003
Ort: Switzerland
Beiträge: 72
hier noch ein kleines update damits wirklich imemr funktioniert

MovieClip.prototype.tomove = function(ypos, xpos, speed) {
this.onEnterFrame = function() {
/*trace(xpos)
trace(this._x)
trace(ypos)
trace(this._y)*/
this._x += (xpos - Math.round(this._x)) / speed;
this._y += (ypos - Math.round(this._y)) / speed;
if (this._x == xpos && this._y == ypos) {
delete this.onEnterFrame;
}
};
};
theMC.tomove(10,10,2);
arniegeddon 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 23:33 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele