我尝试按照本教程
这是我的代码:
import flash.display.Sprite;
import flash.events.Event;
import flash.display.ShaderInput;
import flash.events.KeyboardEvent;
import Input; //here is a problem
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
square = new Sprite();
square.graphics.beginFill(0x333333);
square.graphics.drawRect(0, 0, 30, 30);
square.x = stage.stageWidth / 2 - square.width / 2;
square.y = stage.stageHeight / 2 - square.height / 2;
addChild(square);
Input.initialize(stage); //here is another problem
//Add the refresh loop
addEventListener(Event.ENTER_FRAME, refresh);
}
private function refresh(e:Event):void {
trace("gigi");
}
我收到此错误:
Line 42 1120: Access of undefined property Input.
Line 7 1172: Definition Input could not be found.
有谁知道为什么会出现这种错误? 无法导入类教程输入,但它已被使用。
提前致谢!
答案 0 :(得分:2)
在教程中,有一个"下载附件"下载包含Input类的ZIP的按钮。将其添加到您的src文件夹。