mcMain のコメントを外すと、非常によく似た問題が発生します。メソッド呼び出し。ステージでインスタンスを呼び出そうとすると、「1061: 静的型クラスの参照を介して未定義の可能性があるメソッド addEventListener を呼び出しています。」と表示されます。
以前に別のコンピューターで同様のことを行ったことがありますが、なぜこれが行われているのかわかりません。Adobe Flash CS5.5 および AS3.0 を使用しています。
//These variables will note which keys are down
//We don't need the up or down key just yet
//but we will later
var leftKeyDown:Boolean = false;
var upKeyDown:Boolean = false;
var rightKeyDown:Boolean = false;
var downKeyDown:Boolean = false;
//the main character's speed
var mainSpeed:Number = 7;
//adding a listener to mcMain which will make it move
//based on the key strokes that are down
mcMain.addEventListener(Event.ENTER_FRAME, moveChar);
function moveChar(event:Event):void
{
//if certain keys are down then move the character
if (leftKeyDown)
{
trace("left");
//mcMain.x -= mainSpeed;
}
if (rightKeyDown)
{
trace("right");
//mcMain.x += mainSpeed;
}
//if(upKeyDown || mainJumping){
////mainJump();
//}
}