Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 Actionscript三个旧目标不工作?_Actionscript 3_Flash_Actionscript - Fatal编程技术网

Actionscript 3 Actionscript三个旧目标不工作?

Actionscript 3 Actionscript三个旧目标不工作?,actionscript-3,flash,actionscript,Actionscript 3,Flash,Actionscript,当我的目标是10.3及以上时,这段代码在actionscript 3中运行良好,但当我的目标是flash player 9时,它给出了错误场景1 层“层1”,第1帧,第7 1119行:通过引用静态类型类访问可能未定义的属性L 有人知道我如何解决这个问题,让它在FlashPlayer9中工作吗?我已经试过换键盘(keycode#),甚至试过用FlashPlayer9键码语法? 但我尝试的一切都失败了。我在网上找不到解决方案,有人有什么想法吗?谢谢 var lDown:Boolean = false

当我的目标是10.3及以上时,这段代码在actionscript 3中运行良好,但当我的目标是flash player 9时,它给出了错误场景1

层“层1”,第1帧,第7 1119行:通过引用静态类型类访问可能未定义的属性L

有人知道我如何解决这个问题,让它在FlashPlayer9中工作吗?我已经试过换键盘(keycode#),甚至试过用FlashPlayer9键码语法? 但我尝试的一切都失败了。我在网上找不到解决方案,有人有什么想法吗?谢谢

var lDown:Boolean = false;
var sDown:Boolean = false;
var dDown:Boolean = false;
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyBoardDown);
function onKeyBoardDown(e:KeyboardEvent):void
{
if (e.keyCode == Keyboard.L)
{
    lDown = true;
}
if (lDown == true)
{
    if (e.keyCode == Keyboard.S)
    {
        sDown = true;
    }
}
if (sDown == true)
{
    if (e.keyCode == Keyboard.D)
    {
        dDown = true;
    }
}
if (dDown == true)
{
    trace("ehhh");
    }
}

我对这个问题很感兴趣,因为查看了Flash Player 9+提供的文档,但是正如您所说,当我瞄准Flash Player 9时,我无法通过
键盘
访问常量
A-Z
。但是,我可以访问其他常量,如
F1
HOME
NUMPAD.*
,等等

一旦我将Flash Player版本更改为10或更高版本,我就能够访问
A-Z
常量

我试图找到原因,但是在这个阶段,我只能假设文档是无效的,这些常量在FlashPlayer10之前是不可用的

幸运的是,在这种情况下,解决方法非常简单:为a-Z的字符代码创建自己的常量:

package
{
    public class KeyCodes
    {

        public static const A:uint = 65;
        public static const B:uint = 66;
        public static const C:uint = 67;
        public static const D:uint = 68;
        public static const E:uint = 69;
        public static const F:uint = 70;
        public static const G:uint = 71;
        public static const H:uint = 72;
        public static const I:uint = 73;
        public static const J:uint = 74;
        public static const K:uint = 75;
        public static const L:uint = 76;
        public static const M:uint = 77;
        public static const N:uint = 78;
        public static const O:uint = 79;
        public static const P:uint = 80;
        public static const Q:uint = 81;
        public static const R:uint = 82;
        public static const S:uint = 83;
        public static const T:uint = 84;
        public static const U:uint = 85;
        public static const V:uint = 86;
        public static const W:uint = 87;
        public static const X:uint = 88;
        public static const Y:uint = 89;
        public static const Z:uint = 90;

    }
}
要使用此类,请将内容粘贴到与FLA位于同一目录中的
.as
文件中,然后:

if(e.keyCode == KeyCodes.A) // etc

我正在试图找到确切的原因。

例如,FP9 like Vector中没有许多常规AS3功能。因此,针对FP9的目标很可能会导致无法构建项目,特别是在使用自定义框架的情况下(向量的使用非常普遍)。我实际上不需要构建此项目,它只需要可测试,以便可以在cs6中运行,这是为了SHCOOL谢谢你,很高兴在这里看到所有有帮助的人。嘿,这听起来很无聊,但是我如何将这个类实现到一个可用的fla文件中呢?我试着做了一个包和所有的东西,我就是不能让它工作。我在这件事上浪费了将近一个小时,我想知道你是否能帮我,或者给我指出正确的方向。谢谢。@Altrows哦,对不起,你应该早点说。我会更新我的答案。@Altrows,好了。