目前,我正试图将梯度应用于GraphicsPath对象。我的代码如下:
import flash.display.*;
var style:GraphicsStroke = new GraphicsStroke(3);
style.fill = new GraphicsGradientFill('linear',[0xFF0000,0x00FF00],[1,1],[0,255]);
var line_commands:Vector.<int> = new <int>[1,2];
var line_points:Vector.<Number> = new <Number>[0,0,800,600];
var line:GraphicsPath = new GraphicsPath(line_commands, line_points);
var image:Vector.<IGraphicsData> = new <IGraphicsData>[style, line];
graphics.drawGraphicsData(image);如果我没有弄错的话,使用的笔画应该会使线在红色和绿色之间线性褪色,全红色在0,0,完全绿色在800,600。但是,当运行时,不会出现完全红色,而在0,0点附近只会有一点点淡出的迹象。我已经花了几个小时做选择,但没有结果.有人知道这是怎么回事吗?
发布于 2014-03-05 04:24:13
您忽略了梯度填充对象的matrix参数。
var mat:matrix=new Matrix();
mat.createGradientBox(800,600);
style.fill.matrix=mat;https://stackoverflow.com/questions/22186869
复制相似问题