Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




GradientFill Problem



Hi
I am trying to draw a simple rectangle with symmetrical gradient fill between red and green .
But I can't get it symmetrical - no matter what values I put in ratios array. (The documentation says to put [0,255]).
any ideas?
thanks
joe



ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 04-28-2008, 04:39 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Gradientfill
hey
I have a problem using beginGradientfill. I just do not know what the matrix letters a,b,c... stands for.
Example: I have a triangle with the points A(100,100),B(100,50) and C(500,80). A should be the rotation point. Now I want to make a linear fill from one color to another from A to C DEPENDING on the rotation of the triangle. Whats the matrix for this case ? I hope you can understand what I mean...
thanks alot

GradientFill
Hi,
I have made some Radial GradientFill but I have some problems. The quality is not so grate. What can I do to increase the quality?

GradientFill
Hi,
I have made some Radial GradientFill but I have some problems. The quality is not so grate. What can I do to increase the quality?

GradientFill
Hi,
I have made some Radial GradientFill but I have some problems. The quality is not so grate. What can I do to increase the quality?

Gradientfill On RollOver
i draw a MC with some color(let`s say white),but on rollOver i want it to become a linear gradient
i don`t what to change the stroke color, it should remain black all the time
here`s the code:

ActionScript Code:
_root.createEmptyMovieClip("x", 1);
with (_root.x) {
    //draw MC with white fill
    beginFill(0xffffff, 100);
    moveTo(0, 0);
    lineStyle(0, 0x000000, 100);
    lineTo(75.9, 0);
    lineTo(75.9, 24.1);
    lineTo(0, 24.1);
    lineTo(0, 0);
    endFill();
}
_root.x.onRollOver = function() {
    //i want it to become a linear gradient on rollOver,
    //but don`t know how
    colors = [0xffffff, 0xfb7d48, 0xffffff];
    alphas = [100, 100, 100];
    matrix = {matrixtype:"box", x:18, y:0, w:60, h:0,     r:(180*Math.PI)/180};
    rotation = [85, 170, 255];
    beginGradientFill("linear", colors, alphas, rotation, matrix);
    endFill();
};
_root.x.onRollOut = function() {
    //and then on rollOut
    //i want it to be white again
};

GradientFill Matrix?
Hi guys.


Would someone be kind enough to explain to me, in Layman's Terms, what the MovieClip.beginGradientFill Matrix is and what is does to the gradient?

I have a feeling that it might offset the colour positions but I can't get my head around it at the moment for some reason


Thanks.
Si ++

Drawing Gradientfill Shape Don't Work [as2]
Allright, i tried to draw a simple square shape with a gradient using an old s1 function. It didn't work. I check, with an exemple that macromedia give in flash mx 2004, what was wrong and nothing was wrong !!!!

This is the exemple code from macromedia give in the actionscript dictionary in flash mx 2004.

_root.createEmptyMovieClip( "grad", 1 );
with ( _root.grad )

{

colors = [ 0xFF0000, 0x0000FF ];
alphas = [ 100, 100 ];
ratios = [ 0, 0xFF ];
matrix = { matrixType:"box", x:100, y:100, w:200, h:200, r45/180)*Math.PI };
beginGradientFill( "linear", colors, alphas, ratios, matrix );
moveto(100,100);
lineto(100,300);
lineto(300,300);
lineto(300,100);
lineto(100,100);
endFill();
}

Nothing new, it's the same code in as2 then in as1. But it does'nt work.


What is the problem ?? Is 'Math.PI' the problem ?

any ideas, please share.

Scaling Ratio In A GradientFill On Stage Resize
When my document class is initialized, I'm drawing a rectangle with a gradient fill equal to the size of the stage to give me a black -> gray gradient background. I'm also rotating the gradient fill to give me a vertical linear gradient.

I have added a RESIZE event listener to the stage that redraws the rectangle on RESIZE. Its working fine, but I noticed that my ratios scale with the size of the browser.

My goal is to keep the point where the gradient starts at the same y position (lets say 200px).

here is my code...


Code:
package{
import flash.display.GradientType;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.geom.Matrix;

public class site extends MovieClip{
var matrix:Matrix = new Matrix;

public function site(){
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
init();
}

private function init():void{
drawBG();
stage.addEventListener(Event.RESIZE,drawBG);
}

private function drawBG(evt:Event = null):void{
matrix.createGradientBox(stage.stageWidth,stage.stageHeight,Math.PI/2,0,0);
graphics.clear();
graphics.beginGradientFill("linear",[0x000000,0x000000,0xCCCCCC],[1,1,1],[0,50,255],matrix);
graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);
graphics.endFill();
}
}
}

Copyright © 2005-08 www.BigResource.com, All rights reserved