Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 12-05-2006, 10:36   #1 (permalink)
1x1
 
Registriert seit: Aug 2005
Beiträge: 255
immer 10 frames weiter abspielen

hallo zusammen,

ich möchte mit dem klick auf einen button das in meiner zeitleiste immer 10frames weiter abgespielt werden und danach das ganze stoppt.

ich hab mir überlegt das mit einen prototypen zu realisieren aber das funzt noch nicht richtig:
das ist mein ansatz:

ActionScript:
  1. movieclip.prototype.plus10 = function() {
  2.     this.onEnterFrame = function() {
  3.         this.nextFrame();
  4.         if (this._currentframe + 10) {
  5.             delete this.onEnterFrame;
  6.         }
  7.     };
  8. };

kann mir jemand weiterhelfen?

grüße, icon
icon ist offline   Mit Zitat antworten
Alt 12-05-2006, 10:51   #2 (permalink)
................
 
Benutzerbild von Der Frager
 
Registriert seit: Jun 2004
Beiträge: 15.890
Moin!
PHP-Code:
MovieClip.prototype.plus10 = function() {
    if (!
this.running) {
        
this.running true;
        
this.ziel this._currentframe+10;
        
this.onEnterFrame = function() {
            
this.nextFrame();
            if (
this._currentframe == this.ziel) {
                
delete this.onEnterFrame;
                
this.running false;
            }
        };
    }
}; 
__________________

ternärer Konditionaloperator

+++ Bitte keine Privat-Nachrichten bezüglich Flashfragen! +++
Der Frager ist offline   Mit Zitat antworten
Alt 12-05-2006, 11:01   #3 (permalink)
1x1
 
Registriert seit: Aug 2005
Beiträge: 255
vom feinsten! vielen dank!

grüße & ein schönes wochenende,
icon
icon ist offline   Mit Zitat antworten
Alt 01-06-2006, 17:09   #4 (permalink)
1x1
 
Registriert seit: Aug 2005
Beiträge: 255
hallo nochmal!

ich hab ein kleines problem mit dem prototype plus10():

wenn der prototype plus10() ausgelöst wird aber keine 10frames die abgespielt werden können vorhanden sind hängt sich die gesamte animation auf!

hat jemand eine idee wie man das lösen könnte?!

viele grüße,
icon
Angehängte Dateien
Dateityp: zip plus10minus10 bsp.zip (3,2 KB, 1x aufgerufen)
icon ist offline   Mit Zitat antworten
Alt 02-06-2006, 01:46   #5 (permalink)
1x1
 
Registriert seit: Aug 2005
Beiträge: 255
keiner eine idee oder anregung?

grüße, icon
icon ist offline   Mit Zitat antworten
Alt 02-06-2006, 02:08   #6 (permalink)
Der Wunderhund
 
Benutzerbild von gaspode
 
Registriert seit: Jun 2002
Ort: Hattingen
Beiträge: 10.515
vielleicht so? (habs nicht getestet!)

PHP-Code:
MovieClip.prototype.plus10 = function() {
    if ((
this._currentframe+10) <= this._totalframes) {
        if (!
this.running) { 
            
this.running true;
            
this.ziel this._currentframe+10
            
this.onEnterFrame = function() { 
                
this.nextFrame(); 
                if (
this._currentframe == this.ziel) { 
                    
delete this.onEnterFrame
                    
this.running false
                } 
            }
        }
    }

gruß, gaspode

Geändert von gaspode (02-06-2006 um 02:10 Uhr)
gaspode ist offline   Mit Zitat antworten
Alt 02-06-2006, 10:32   #7 (permalink)
................
 
Benutzerbild von Der Frager
 
Registriert seit: Jun 2004
Beiträge: 15.890
PHP-Code:
if (this._currentframe == this.ziel || this._currentframe == this._totalframes) { 
...täte ich mal sagen tun.
__________________

ternärer Konditionaloperator

+++ Bitte keine Privat-Nachrichten bezüglich Flashfragen! +++
Der Frager ist offline   Mit Zitat antworten
Alt 02-06-2006, 16:30   #8 (permalink)
1x1
 
Registriert seit: Aug 2005
Beiträge: 255
ja vielen dank!

so ich hab jetzt probiert das ganze auch auf den minus10() prototypen anzuwenden allerdings ohne grossen erfolg:

ActionScript:
  1. MovieClip.prototype.minus10 = function() {
  2.  //
  3. // if(this._currentframe>1)   
  4. //
  5.  if (!this.running) {
  6.         this.running = true;
  7.         this.ziel = this._currentframe-10;
  8.         this.onEnterFrame = function() {
  9.             this.prevFrame();
  10.             if (this._currentframe == this.ziel) {
  11.                 delete this.onEnterFrame;
  12.                 this.running = false;
  13.             }
  14.         };
  15.     }
  16. };

man soll den prototype nicht anwenden können wenn der frame = 1 ist.
mit meinem currentframe klappt das aber nicht.

woran liegts?

viele grüße,
icon
icon ist offline   Mit Zitat antworten
Alt 02-06-2006, 17:10   #9 (permalink)
................
 
Benutzerbild von Der Frager
 
Registriert seit: Jun 2004
Beiträge: 15.890
Kannst du auch mit einer Funktion machen:
PHP-Code:
MovieClip.prototype.plus_minus = function(anzahl) {
    if (!
this.running) {
        
this.running true;
        
this.ziel this._currentframe+anzahl;
        
this.onEnterFrame = function() {
            
anzahl>this.nextFrame() : this.prevFrame();
            if (
this._currentframe == this.ziel || this._currentframe == || this._currentframe == this._totalframes) {
                
delete this.onEnterFrame;
                
this.running false;
            }
        };
    }
}; 
Aufruf dann halt mc.plus_minus(10) bzw. mc.plus_minus(-10) oder -4 oder +6 oder was auch immer.

Edit: Sollte nur nicht mit 0 aufgerufen werden, aber das macht ja eh keinen Sinn.
__________________

ternärer Konditionaloperator

+++ Bitte keine Privat-Nachrichten bezüglich Flashfragen! +++

Geändert von Der Frager (02-06-2006 um 17:11 Uhr)
Der Frager ist offline   Mit Zitat antworten
Alt 03-06-2006, 09:31   #10 (permalink)
1x1
 
Registriert seit: Aug 2005
Beiträge: 255
hallo der frager!
ja das ist natürlich noch besser, danke!

schönes wochenende!
grüße, icon
icon ist offline   Mit Zitat antworten
Alt 04-06-2006, 01:40   #11 (permalink)
1x1
 
Registriert seit: Aug 2005
Beiträge: 255
guten morgen,

was mir gerade durch den kopf geht:

ist es eigentlich möglich mit der funktion "plus_minus" nach dem abspielen von der bestimmten anzahl frames, auch noch zu einem bestimmten frame zu springen?

ich hab das so probiert:
ActionScript:
  1. on (press) {
  2.     _root.plus_minus(10);
  3.     if (plus_minus(10)) {
  4.     }
  5.     _root.gotoAndStop(25);
  6. }

das funktioniert nicht weil die 10frames nicht abgespielt werden sondern es direkt zu frame 25 gesprungen wird!

vielleicht hat ja jemand eine idee!

grüße, icon
icon ist offline   Mit Zitat antworten
Alt 04-06-2006, 01:45   #12 (permalink)
Der Wunderhund
 
Benutzerbild von gaspode
 
Registriert seit: Jun 2002
Ort: Hattingen
Beiträge: 10.515
Hi.

Da müßtest Du einen Parameter mehr übergeben:

PHP-Code:
MovieClip.prototype.plus_minus*=*function(anzahlzielframe)*{ 
****if*(!
this.running)*{ 
********
this.running*=*true
********
this.ziel*=*this._currentframe+anzahl
********
this.onEnterFrame*=*function()*{ 
************
anzahl>0*?*this.nextFrame()*:*this.prevFrame(); 
************if*(
this._currentframe*==*this.ziel*||*this._currentframe*==*1*||*this._currentframe*==*this._totalframes)*{ 
****************
delete*this.onEnterFrame
****************
this.running*=*false;
                
this.gotoAndStop(zielframe);
************} 
********}
****} 

Aufruf dann über _root.plus_minus(10, 25);

zumindest theoretisch, da nicht getestet.
Achja, denk Dir alle Sterne (*) weg. Ich habe
gerade keine Lust, die alle manuell zu löschen.

gruß, gaspode
gaspode ist offline   Mit Zitat antworten
Alt 04-06-2006, 02:03   #13 (permalink)
1x1
 
Registriert seit: Aug 2005
Beiträge: 255
hallo,

ja funktioniert super, danke!
das einem zu so später stunde auch noch so schnell geholfen wird ist einfach super!

eine gute nacht noch!
icon
icon ist offline   Mit Zitat antworten
Alt 04-06-2006, 02:46   #14 (permalink)
Der Wunderhund
 
Benutzerbild von gaspode
 
Registriert seit: Jun 2002
Ort: Hattingen
Beiträge: 10.515
>das einem zu so später stunde auch noch so schnell geholfen wird ist einfach super!

Das flashforum schläft nie.

gruß, gaspode
gaspode 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 15:50 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele