我不斷收到#1009錯誤,我檢查了一切都在我的舞臺上並被正確命名。TypeError:錯誤#1009:無法訪問空對象引用的屬性或方法。在Videogame_fla :: MainTimeline/loop()
這是出現的錯誤消息: TypeError:錯誤#1009:無法訪問空對象引用的屬性或方法。 在Videogame_fla :: MainTimeline /環路()
這裏是我的代碼:
var carrot:Number = Math.floor(Math.random() * 460) +0;
var carrot1:Number = Math.floor(Math.random() * 460) +0;
var carrot2:Number = Math.floor(Math.random() * 460)+0;
var carrot3:Number = Math.floor(Math.random() * 460)+0;
var carrot4:Number = Math.floor(Math.random() * 460)+0;
var bomb:Number = Math.floor(Math.random() * 460)+0;
var bomb1:Number = Math.floor(Math.random() * 460)+0;
var bomb2:Number = Math.floor(Math.random() * 460)+0;
var bomb3:Number = Math.floor(Math.random() * 460)+0;
var bomb4:Number = Math.floor(Math.random() * 460)+0;
var cloud1:Number = Math.floor(Math.random() * 460)+0;
var cloud2:Number = Math.floor(Math.random() * 460)+0;
var cloud3:Number = Math.floor(Math.random() * 460)+0;
var cloud4:Number = Math.floor(Math.random() * 460)+0;
stage.addEventListener(Event.ENTER_FRAME,loop);
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDownevent);
stage.addEventListener(KeyboardEvent.KEY_UP,keyUpevent);
function loop(myevent:Event)
{
carrot_mc.x = carrot;
carrot1_mc.x = carrot1;
carrot2_mc.x = carrot2;
carrot3_mc.x = carrot3;
carrot4_mc.x = carrot4;
bomb_mc.x = bomb;
bomb1_mc.x = bomb1;
bomb2_mc.x = bomb2;
bomb3_mc.x = bomb3;
bomb4_mc.x = bomb4;
cloud1_mc.x = cloud1;
cloud2_mc.x = cloud2;
cloud3_mc.x = cloud3;
cloud4_mc.x = cloud4;
}