Zurück   Flashforum > Flash > Flash Fortgeschritten > Flash 8

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 03-10-2005, 23:16   #1 (permalink)
Neuer User
 
Registriert seit: Apr 2005
Beiträge: 58
Talking script wird immer langsammer

moin leute,
hier mal mein erstes AS 8 script(hab ein beispeil etwas verändert:

ActionScript:
  1. this.createEmptyMovieClip("gradient_mc", this.getNextHighestDepth());
  2. var ver = 5;
  3.  
  4. var rot = 0xFF0000;
  5. var blau = 0x0000ff;
  6. var gruen = 0x00ff00;
  7. var tempc;
  8. var tempr;
  9. colors = [rot, blau, gruen, rot, blau];
  10. ratios = [85, 170, 255, 255, 255];
  11. this.onEnterFrame = function() {
  12.     with (gradient_mc) {
  13.         fillType = "radial";
  14.         alphas = [100, 100, 100, 100, 100];
  15.         spreadMethod = "reflect";
  16.         interpolationMethod = "linearRGB";
  17.         focalPointRatio = 0;
  18.         matrix = {a:200, b:0, c:0, d:0, e:200, f:0, g:275, h:200, i:1};
  19.         beginGradientFill(fillType, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPointRatio);
  20.         moveTo(0, 0);
  21.         lineTo(550, 0);
  22.         lineTo(550, 400);
  23.         lineTo(0, 400);
  24.         lineTo(0, 0);
  25.         endFill();
  26.        
  27.         for(var i = 0; i <= ratios.length - 2; i++){
  28.             if(ratios[i] > 0){
  29.                 ratios[i] -= ver;
  30.                
  31.             }
  32.            
  33.             if(ratios[1] <= 0){
  34.                 ratios.shift();
  35.                
  36.                 ratios[ratios.length] = 255;
  37.                 tempc = colors.shift();
  38.                 colors[colors.length] = tempc;
  39.             }
  40.         }
  41.            
  42.     }
  43. };

und jetzt meine frage :
weiß veilleicht einer von euch warum das script nach einer weile immer langsammer wird?
freue mich auf eure antworten
david
__________________
PHP-Code:
for(var i:Number 0error.lengthi++){
    
trace(error.unbekannterBlödsinn);

bdavidb ist offline   Mit Zitat antworten
Alt 04-10-2005, 00:25   #2 (permalink)
:Void
 
Benutzerbild von janoshnosh
 
Registriert seit: Jun 2005
Ort: börlin
Beiträge: 931
klar, steht doch ganz groß im script
du lässt da frame für frame jede menge zeichnen, ohne jemals auch was von dem gezeichneten wieder zu entfernen, und auch ohne das onEnterFrame-event jemals zu löschen => folglich hat der player immer mehr zu tun und wird langsamer.
schreib da mal schnell ein clear() direkt als erstes in die with() { } klammern, dann sollte es flüssiger gehn!

gruß janosch
janoshnosh ist offline   Mit Zitat antworten
Alt 04-10-2005, 11:17   #3 (permalink)
Neuer User
 
Registriert seit: Apr 2005
Beiträge: 58
danke janosch,
jetzt geht es ausgezeichnet,
echt dumm das ich da nicht selbst drauf gekommen bin
david
__________________
PHP-Code:
for(var i:Number 0error.lengthi++){
    
trace(error.unbekannterBlödsinn);

bdavidb 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 19:30 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele