我正在制作pong克隆的教程,目前我正在尝试将BevelFilter添加到球形图像中。当我输入代码时,它会返回错误
undefined property bitmapfilter type
我查看了live docs,它应该有效。我用两个*标记了该行
package
{
import flash.display.Sprite;
import flash.display.Graphics;
import flash.events.Event;
import flash.filters.BevelFilter;
import flash.filters.GlowFilter;
public class Ball extends Sprite
{
private const RADIUS:int = 12;
private const COLOR:uint = 0x01A6B2;
private const COLOR2:uint = 0x45FCFF;
** private const BEVEL:BevelFilter = new BevelFilter(4, 90, COLOR2, 1, COLOR2, 1, 10, 10, 1, 1, BitmapFilterType.Inner, true);
private const GLOW:GlowFilter = new GlowFilter(0xFFFFFF, .6, 0, 0, 5, 1, true);
public function Ball():void {
addEventListener(Event.ADDED_TO_STAGE, go);
}
private function go(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, go);
graphics.lineStyle(2, COLOR, 1);
graphics.beginFill(COLOR);
graphics.drawCircle(0, 0, RADIUS);
filters = [BEVEL, GLOW];
}
}
}
谢谢!
答案 0 :(得分:1)
我经常使用这些。你的代码应该是这样的......
private const BEVEL:BevelFilter = new BevelFilter(4, 90, COLOR2, 1, COLOR2, 1, 10, 10, 1, 1, "inner", true);
倒数第二个参数接受一个字符串。
不确定文档为何以不同方式表示。这是关于Adobe Flash CS6的代码提示,我知道这应该有效。