Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 02-09-2003, 11:49   #1 (permalink)
Gedankengestalter
 
Benutzerbild von TheFreeman
 
Registriert seit: May 2002
Ort: Bayern
Beiträge: 486
Dynamischee Farbwechsel für Schaltflächen

Hi.

Ich doktore schon seit fast zwei Wochen an folgendem Script und bin am verzweifeln:

ActionScript:
  1. MovieClip.prototype.fwechsel1 = function(co){
  2.     this.createEmptyMovieClip("emc_"add co, 999);
  3.     this["emc_"add co].onLoad = function(){
  4.        
  5.         a=this;
  6.         b= a.substr(a.indexOf("emc_")+4);      
  7.        
  8.         this.cnt=0;
  9.         this.startColor = _root.Farbe1;
  10.         this.newColor = _root.Farbe2;
  11.         this.col = new Color(_root[b]); // Farb-Objekt
  12.         this.col.setRGB(parseInt(this.startColor,16))// setzen des Startwerts
  13.         this.steps = _root.Stufen;
  14.         this.r = parseInt(this.startColor.substr(0,2),16); // ermitteln der einzelnen Komponenten des Startwerts
  15.         this.g = parseInt(this.startColor.substr(2,2),16);
  16.         this.b = parseInt(this.startColor.substr(4,2),16);
  17.        
  18.         this.newR = parseInt(this.newColor.substr(0,2),16); // ermitteln der einzelnen Komponenten des Endwerts
  19.         this.newG = parseInt(this.newColor.substr(2,2),16);
  20.         this.newB = parseInt(this.newColor.substr(4,2),16);
  21.        
  22.         this.diffR = (this.r - this.newR) / this.steps; // Berechnung der Differenzen
  23.         this.diffG = (this.g - this.newG) / this.steps;
  24.         this.diffB = (this.b - this.newB) / this.steps;
  25.        
  26.     }
  27.     this["emc_"add co].onEnterFrame = function(){
  28.             cnt++;
  29.             if(cnt < steps) {
  30.                 this.rgb = _root[b].col.getRGB().toString(16); // aktuelle Farbe auslesen
  31.                 this.r = parseInt(this.rgb.substr(0,2),16);
  32.                 this.g = parseInt(this.rgb.substr(2,2),16);
  33.                 this.b = parseInt(this.rgb.substr(4,2),16);
  34.                 this.newR = Math.floor(this.r-this.diffR).toString(16);
  35.                 this.newG = Math.floor(this.g-this.diffG).toString(16);
  36.                 this.newB = Math.floor(this.b-this.diffB).toString(16);
  37.                 if(this.newR.length == 1) this.newR = "0" + this.newR;
  38.                 if(this.newG.length == 1) this.newG = "0" + this.newG;
  39.                 if(this.newB.length == 1) this.newB = "0" + this.newB;
  40.                 this.newColString = this.newR + this.newG + this.newB;    // neue Farbe zusammensetzen und zuweisen
  41.                 _root[b].col.setRGB(parseInt(this.newColString,16));
  42.             }else{
  43.                 this.cnt=0;
  44.                 delete this.onEnterFrame;
  45.                 delete this;
  46.             }
  47.     }
  48. }
  49.  
  50. Warum geht das so nicht?
__________________
AS3 Lernhilfen
TheFreeman ist offline   Mit Zitat antworten
Alt 02-09-2003, 17:19   #2 (permalink)
bastix
Gast
 
Beiträge: n/a
HI
Ich hab grade ein paint Clone geschrieben , ich bin also durchaus mit dem Thema bewandt.
Leider habe ich jetzt keine Zeit das Script durchzuschauen!

later
  Mit Zitat antworten
Alt 03-09-2003, 08:48   #3 (permalink)
Gedankengestalter
 
Benutzerbild von TheFreeman
 
Registriert seit: May 2002
Ort: Bayern
Beiträge: 486
Da bin ich gespannt. Ich kanns gar nicht erwarten.
Danke schonmal.
__________________
AS3 Lernhilfen
TheFreeman 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 05:26 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele