简体   繁体   English

为什么不导入此类? AS3

[英]Why not importing the this class? AS3

I try to follow this tutorial 我尝试按照本教程

link 链接

This is my code: 这是我的代码:

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");
        }

I receive this error: 我收到此错误:

Line 42 1120: Access of undefined property Input.
Line 7  1172: Definition Input could not be found.

Does anyone know why this error occurs? 有谁知道为什么会发生此错误? Unable to import class tutorial Input but it is used. 无法导入类教程输入,但已使用。

Thanks in advance! 提前致谢!

In the tutorial, there is a "Download Attachment" button which downloads a ZIP containing the Input class. 在本教程中,有一个“下载附件”按钮,用于下载包含Input类的ZIP。 Add this to your src folder. 将此添加到您的src文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM