加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

actionscript-3 – Actionscript三个旧目标无法正常工作?

发布时间:2020-12-15 07:28:40 所属栏目:百科 来源:网络整理
导读:当我的目标是10.3及以上但是当我的目标是flash player 9时,此代码在actionscript 3中工作正常,它给出了错误场景1, 层’第1层’,第1帧,第7行1119:通过具有静态类型Class的引用访问可能未定义的属性L. 任何人都知道如何解决这个问题,以便它可以在Flash Player
当我的目标是10.3及以上但是当我的目标是flash player 9时,此代码在actionscript 3中工作正常,它给出了错误场景1,

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

任何人都知道如何解决这个问题,以便它可以在Flash Player 9中运行?我已经尝试过改变键盘了.(键码#)甚至尝试使用闪存播放器9键码语法?
但我尝试的一切都失败了.我无法在网上找到解决方案,任何人都有任何想法?谢谢

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

解决方法

我对这个问题很感兴趣,因为查看文档,Keyboard and its constants可以从Flash Player 9获得,但是就像你说的那样,我无法在定位Flash Player 9时通过键盘访问常量AZ.但我可以访问其他常量,如F1,HOME,NUMPAD_ *等

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

我试图找到原因,但是在这个阶段,我可以假设文档无效,并且这些常量在Flash Player 10之前实际上不可用.

幸运的是,在这种情况下,解决方法非常简单:为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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读