在ActionScript中使用梯度的错误

问题描述 投票:0回答:1

我目前收到以下错误。

场景1,图层'图层1',第1帧,第172行 1119:通过静态类型flash.display:GraphicsGradientFill的引用访问可能未定义的属性连接。


场景1,图层'图层1',第1帧,第173行 1067: 将flash.display:GraphicsSolidFill类型的值隐式强制到一个不相关的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);

是什么原因导致这些错误?

actionscript-3 flash vector-graphics
1个回答
3
投票

试试。

import flash.display.JointStyle;

JointStyle.MITER

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

编辑新的错误。

GraphicsGradientFill 没有一个属性 jointsalphas 属性期待一个数组。我想也许你正在寻找的是 GraphicsStroke 而不是 GraphicsGradientFill 为变量 stroke?

© www.soinside.com 2019 - 2024. All rights reserved.