My question is about the RATIO attribute of the Graphics.beginGradientFill() method.

Example:
graphics.beginGradientFill(GradientType.RADIAL,[0x0000FF,0x00F9FF],[.27,1],[0,255]);
graphics.drawCircle(0,0,size);
graphics.endFill();

Now, if my understanding is correct, a Ratio attribute of [0,255] will basically set one color to the outside edge of my circle and the other color will occur at the direct center. In other words, the entire gradient will be shown.

What I am getting is the first color pushes the second color way out of the circle, not even showing it.

Are the docs wrong? Is this not a ratio? Am I stupid? The answer to the last question is probably yes, but any help will be great.

Excerpt from API docs:

ratios:Array — An array of color distribution ratios; valid values are 0 to 255. This value defines the percentage of the width where the color is sampled at 100%. Specify a value for each value in the colors parameter.

For example, for a linear gradient that includes two colors, blue and green, the following figure illustrates the placement of the colors in the gradient based on different values in the ratios array:

ratios Gradient
[0, 127]
[0, 255]
[127, 255]

Reply via email to