ActionScript 中的渐变错误

Errors with Gradients in ActionScript

我目前收到以下错误:

Scene 1, Layer 'Layer 1', Frame 1, Line 172 1119: Access of possibly undefined property joints through a reference with static type flash.display:GraphicsGradientFill.


Scene 1, Layer 'Layer 1', Frame 1, Line 173 1067: Implicit coercion of a value of type flash.display:GraphicsSolidFill to an unrelated type Array.

尝试创建这样的渐变时:

import flash.display.JointStyle;

var stroke:GraphicsGradientFill = new GraphicsGradientFill();
stroke.joints = JointStyle.MITER;
stroke.alphas = new GraphicsSolidFill(0x102020, 1);

var fill:GraphicsGradientFill = new GraphicsGradientFill();
fill.colors = [0x0000FF, 0xEEFFEE];
fill.matrix = new Matrix();
fill.matrix.createGradientBox(70, 70, Math.PI / 2);

var path:GraphicsPath = new GraphicsPath(new Vector.<int>(), new Vector.<Number>);
path.commands.push(1, 2, 2);
path.data.push(125, 0, 50, 100, 175, 0);

var drawing:Vector.<IGraphicsData> = new Vector.<IGraphicsData>();
drawing.push(stroke, fill, path);

graphics.drawGraphicsData(drawing);

是什么导致了这些错误?

尝试:

import flash.display.JointStyle;

JointStyle.MITER

编辑: 更改 stroke.joints = JoinStyle.MITER; => stroke.joints = JointStyle.MITER;

编辑新错误:

GraphicsGradientFill 没有 属性 jointsalphas 属性 需要一个数组。我想也许您正在为变量 stroke?

寻找 GraphicsStroke 而不是 GraphicsGradientFill