0

我在尝试让我的课程正常工作时遇到了相当大的困难,无论我如何改变它,我都会不断出错。我得到的当前错误是“一个 ActionScript 文件不能有多个外部可见定义:PlayerPic,arrowMove”

代码:

package  {

    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.events.MouseEvent;

    public class PlayerPic extends MovieClip {
        public function PlayerPic()}

        {
            stage.addEventListener(KeyboardEvent.KEY_DOWN, arrowMove)
            // constructor code
            trace ("PlayerPic Constructer")}



    function arrowMove(event:KeyboardEvent):void{

    if (event.keyCode == Keyboard.LEFT)
        {
            pp.x -= 5;
            if (pp.x < 0)
        {
           pp.x = 0;
        }
        }
    if (event.keyCode == Keyboard.RIGHT)
        {
            pp.x += 5;
            if (pp.x > 250)
        {
            pp.x = 250;
        }
        }
        if (event.keyCode == Keyboard.UP)
        {
            pp.y -= 5;
            if (pp.y < 0)
        {
            pp.y = 0;
        }
        }
        if (event.keyCode == Keyboard.DOWN)
        {
            pp.y += 5;
        if (pp.y > 550)
        {
           pp.y = 550;
        }
        }

    }

}
4

1 回答 1

0

尝试改变这个:

public function PlayerPic()}

对此:

public function PlayerPic()
于 2013-08-13T15:35:06.183 回答