Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 16-06-2004, 16:37   #1 (permalink)
Neuer User
 
Registriert seit: Aug 2001
Ort: Austria/Vienna
Beiträge: 225
Gradient Box

Hallo,

ich möchte mit createEmptyMovieClip und lineTo eine Box erstellen und diese mit einem Farbverlauf versehen. von zb. rot auf blau geht das auch ganz gut. Nun möchte ich aber einen verlauf von rot auf blau und zurück auf rot.

Ich hab zwar einen Workaround gefunden, indem ich 2 boxen zeichnen lasse. eine von rot auf blau, und die 2. von blau auf rot.

Hätte aber gerne eine elegantere Lösung.

Kann mir jemand weiterhelfen?

Hier mein workaround
PHP-Code:
MovieClip.prototype.drawGradientLine = function(col1,col2) {
    var 
mc this.createEmptyMovieClip("balken1"1);
    
colors = [col1col2];
    
alphas = [10030];
    
ratios = [100250];
    
matrix = {matrixType:"box"x:-160y:0w:160h:2r:(180) * Math.PI};
    
with (mc) {
        
beginGradientFill("linear"colorsalphasratiosmatrix);
        
moveTo(0, -1);
        
lineTo(-160, -1);
        
lineTo(-1601);
        
lineTo(01);
        
lineTo(0, -1);
        
endFill();
    }
    var 
mc this.createEmptyMovieClip("balken2"3);
    
colors = [col1col2];
    
alphas = [10030];
    
ratios = [100250];
    
matrix = {matrixType:"box"x:0y:0w:160h:2r:(180 180) * Math.PI};
    
with (mc) {
        
beginGradientFill("linear"colorsalphasratiosmatrix);
        
moveTo(0, -1);
        
lineTo(160, -1);
        
lineTo(1601);
        
lineTo(01);
        
lineTo(0, -1);
        
endFill();
    }
};
drawGradientLine(0xff6600,0x00ff00);//zeichnet eine 320px lange linie 
thx
TF
TigerFox ist offline   Mit Zitat antworten
Alt 17-06-2004, 07:47   #2 (permalink)
Level up
 
Benutzerbild von Alois
 
Registriert seit: Jun 2001
Ort: Bocholt
Beiträge: 4.155
wenn es, wie im Beispiel, nur um einer 'Verlaufslinie' geht, kannst Du ja mit dem radialen Verlauf tricksen:
PHP-Code:
MovieClip.prototype.drawGradientLine = function(col1,col2) { 

    var 
mc this.createEmptyMovieClip("balken1"3); 
    
colors = [col1col2]; 
    
alphas = [10030]; 
    
ratios = [100250]; 
    
matrix = {matrixType:"box"x:0y:-1000w:160h:2000r:0}; 
    
with (mc) { 
        
beginGradientFill("radial"colorsalphasratiosmatrix); 
        
moveTo(0, -1); 
        
lineTo(160, -1); 
        
lineTo(1601); 
        
lineTo(01); 
        
lineTo(0, -1); 
        
endFill(); 
    } 
}; 
drawGradientLine(0xff6600,0x00ff00); 
Gruß

Alois
__________________
-Spuckt mir auf den Stuhl, ich will im Grünen sitzen-

Geändert von Alois (17-06-2004 um 07:48 Uhr)
Alois ist offline   Mit Zitat antworten
Alt 17-06-2004, 09:53   #3 (permalink)
Neuer User
 
Registriert seit: Aug 2001
Ort: Austria/Vienna
Beiträge: 225
Super, vielen Dank!
hab noch ein bisschen mit den parametern rumspielen müssen, aber jetzt klappt es wunderbar.

thx
TF
TigerFox 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 17:15 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele