0
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
            }
}

每当我尝试运行它时,我都会收到以下错误:“Scene=Scene 1, layer=Layer 1, frame=1, Line 21 'else' 遇到没有匹配 'if'”

4

1 回答 1

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))
    {            
于 2013-05-10T18:13:00.850 回答