Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 16-07-2006, 15:59   #1 (permalink)
05
 
Benutzerbild von gorgeous
 
Registriert seit: Nov 2004
Beiträge: 346
Question prototype: ziel currentframe dynamisch bestimmen

hallo,

kann mir jemand sagen wie ich diesen prototype ändern muss damit ich den _currentframe beim aufruf dynamisch bestimmen kann?
ist das überhaupt möglich?

das ist mein prototype:
ActionScript:
  1. movieclip.prototype.ziel = function() {
  2.     this.onEnterFrame = function() {
  3.         this.nextFrame();
  4.         if (this._currentframe == 10) {
  5.             delete this.onEnterFrame;
  6.         }
  7.     };
  8. };
  9. //aufruf:
  10. mc.ziel()

ich möchte halt z.b. sagen können "spiele bis frame 40" ohne das ich den ganzen prototype kopieren und dementsprechend ändern muss.

vielleicht hat ja jemand einen hinweis für mich!
grüße & schönen sonntag, gorgeous
__________________
:)
gorgeous ist offline   Mit Zitat antworten
Alt 16-07-2006, 16:48   #2 (permalink)
voidboy
 
Benutzerbild von rendner[i]
 
Registriert seit: Sep 2004
Ort: München
Beiträge: 5.588
PHP-Code:
MovieClip.prototype.ziel = function( frame 
{
    if( 
this._currentframe frame )
    {
        
this.onEnterFrame = function() 
        {
            
this.nextFrame();
            if ( 
this._currentframe == frame 
            {
                
delete this.onEnterFrame;
            }
        }
    }
}

mc.ziel40 ); 
__________________
ERROR: Signature is too large

Geändert von rendner[i] (16-07-2006 um 16:49 Uhr)
rendner[i] ist offline   Mit Zitat antworten
Alt 16-07-2006, 17:51   #3 (permalink)
05
 
Benutzerbild von gorgeous
 
Registriert seit: Nov 2004
Beiträge: 346
genau richtig! vielen dank!

grüße, gorgeous
__________________
:)
gorgeous ist offline   Mit Zitat antworten
Alt 24-07-2006, 01:26   #4 (permalink)
05
 
Benutzerbild von gorgeous
 
Registriert seit: Nov 2004
Beiträge: 346
hallo,

wenn der zielframe in der zeitleiste hinter dem aktuellen frame liegt funktioniert der prototype nicht mehr.

hatte es mit dem unteren AS probiert um das zu ändern aber leider ohne erfolg. kann mir jemand sagen was falsch ist?
ActionScript:
  1. MovieClip.prototype.zf = function(frame) {
  2.     if (this._currentframe<frame) {
  3.         this.onEnterFrame = function() {
  4.             this.nextFrame();
  5.              if ( this._currentframe == frame )
  6.              delete this.onEnterFrame;
  7. //hier liegt das problem:
  8.             if (this._currentframe>frame) {
  9.                        this.onEnterFrame = function() {    
  10.                            this.prevFrame();
  11.                  if ( this._currentframe == frame ) 
  12.                 delete this.onEnterFrame;
  13.             }}
  14.         };
  15.     }
  16. };
  17. //aufruf
  18. mc.zf(40);

würde halt auch gerne das ganze "in beide richtungen" anwenden können.


viele grüße,
gorgeous
__________________
:)
gorgeous ist offline   Mit Zitat antworten
Alt 24-07-2006, 08:15   #5 (permalink)
voidboy
 
Benutzerbild von rendner[i]
 
Registriert seit: Sep 2004
Ort: München
Beiträge: 5.588
PHP-Code:
MovieClip.prototype.ziel = function( frame )  

    if( 
this._currentframe frame 
    { 
        
this.onEnterFrame = function()  
        { 
            
this.nextFrame(); 
            if ( 
this._currentframe == frame )  
            { 
                
delete this.onEnterFrame
            } 
        } 
    } 
    if( 
this._currentframe frame 
    { 
        
this.onEnterFrame = function()  
        { 
            
this.prevFrame(); 
            if ( 
this._currentframe == frame )  
            { 
                
delete this.onEnterFrame
            } 
        } 
    } 



mc.ziel40 ); 
Also bei mir funktioniert es einwandfrei!
__________________
ERROR: Signature is too large
rendner[i] ist offline   Mit Zitat antworten
Alt 24-07-2006, 08:27   #6 (permalink)
05
 
Benutzerbild von gorgeous
 
Registriert seit: Nov 2004
Beiträge: 346
danke, ich hatte die klammern dazwischen vergessen!

grüsse,
gorgeous
__________________
:)
gorgeous 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 03:04 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele