错误1120:未定义的属性的访问 [英] Error 1120:Access of undefined property
本文介绍了错误1120:未定义的属性的访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到未定义的属性从我已经出演线以下code访问的错误,即使我已经进一步明确了功能的类:
I am receiving an error of access of undefined property from the following code on the line which i've starred, even though i have already defined the function further in the class:
package {
import flash.display.Stage;
import flash.events.Event;
import flash.events.KeyboardEvent;
public class Key{
private static var initialized:Boolean = false;
private static var keysDown:Object = new Object();
private function initialize(stage:Stage){
if(!initialized){
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
**stage.addEventListener(Event.DEACTIVATE, clearKeys);**
initialized = true;
}
}
public static function isDown(keyCode:uint):Boolean {
return Boolean(keyCode in keysDown);
}
Private static function keyPressed(event:KeyboardEvent):void {
keysDown[event.keyCode] = true;
}
private static function keyReleased(event:KeyboardEvent):void{
if(event.keyCode in keysDown){
delete keysDown[event.keyCode];
}
}
Private static function clearkeys(event:Event):void{
keysDown = new Object():
}
}
}
编辑:新的错误雨后春笋般冒出来后,我有固定的上限错误(谢谢你杰森)。 谁能帮我这个?
New error popping up after I have fixed the caps error (Thank you Jason). Can anyone help me with this?
推荐答案
私人
必须小写是访问修饰符关键字私人
。
Private
must be lowercase to be the access modifier keyword private
.
如:
private static var initialized:Boolean = false;
由于大写私人
编译器假定您要引用命名空间私人,如:
As upper case Private
the compiler assumes you are referencing namespace "Private", such as:
package
{
import flash.utils.flash_proxy;
import mx.core.mx_internal;
use namespace arcane;
public dynamic class X
{
flash_proxy var prop1:Boolean;
mx_internal var prop2:Boolean;
arcane var prop3:Boolean;
}
}
这篇关于错误1120:未定义的属性的访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文