this.onEnterFrame = function()
{
if(Key.isDown(Key.RIGHT))
{
asdf._x += 10;
}else if (Key.isDown(Key.LEFT))
{
asdf._x -= 10;
}else if (Key.isDown(Key.UP))
{
asdf._y -= 10;
}else if (Key.isDown(Key.DOWN))
{
asdf._y += 10;
}
}
var i = 0;
this.onEnterFrame = function()
{
else if (Key.isDown(Key.DOWN))
{
asdf._y += 5;
}
if (Key.isDown(Key.SPACE))
{
i++;
_root.attachMovie("Bullet", "Bullet" + i,_root.getNextHighestDepth());
_root["Bullet" + i]._x = asdf._x + 3;
_root["Bullet" + i]._y = asdf._y
}
}
每当我尝试运行此操作时,我都会收到以下错误:“场景=场景1,图层=图层1,帧= 1,行21'否则'遇到没有匹配'如果'”
答案 0 :(得分:2)
var i = 0;
this.onEnterFrame = function()
{
else if (Key.isDown(Key.DOWN))
{
您无法使用else
启动功能而无需相应的if
。你的意思可能只是简单的;
var i = 0;
this.onEnterFrame = function()
{
if (Key.isDown(Key.DOWN))
{