0

我的程序编译中有一个奇怪的错误...

对于我的程序场景,它只是一个使用键盘箭头移动的电影剪辑名称“perso”。

Flash 说我找不到“clavierUp”和“动画”属性访问。

我真的不明白...

var perso:Perso = new Perso();

stage.addEventListener(KeyboardEvent.KEY_DOWN, clavierDown);
stage.addEventListener(KeyboardEvent.KEY_UP, clavierUp);
stage.addEventListener(Event.ENTER_FRAME, animation);

function clavierDown(e)
{
    switch(e.keyCode)
    {   
        case Keyboard.LEFT:
            perso.speedX = -speedHero;
            break;
        case Keyboard.RIGHT:
            perso.speedX = speedHero;
            break;
        case Keyboard.UP:
            perso.speedY = -speedHero;
            break;
        case Keyboard.DOWN:
            perso.speedY = speedHero;
            break;
    }

function clavierUp(e)
{
    switch(e.keyCode)
    {
        case Keyboard.LEFT:
            perso.speedX = 0;
            perso.scaleX = -1;
            break;  

        case Keyboard.RIGHT:
            perso.speedX = 0;
            perso.scaleX = 1;
            break;

        case Keyboard.UP:
            perso.speedY = 0;
            break;

            case Keyboard.DOWN:
            perso.speedY = 0;
            break;
    }
}

function animation(e)
{
    animeHero();
}

谢谢 !

4

1 回答 1

0

Sorry, i just missed a rightbrace at the end of "clavierDown" function...

于 2013-01-29T20:05:29.453 回答