我忙於編程一款遊戲,但我一直在困難的東西。錯誤#1009閃存,無法弄清楚
我已經能夠讓遊戲在以前完美工作,但突然間它停止工作。
這裏是給錯誤的腳本的一部分:
var colorTransform:ColorTransform;
var player:MovieClip;
var kaas:MovieClip;
var ground:MovieClip;
var speed:Number;
var right:Boolean = false;
var left:Boolean = false;
var up:Boolean = false;
var down:Boolean = false;
var isWalking:Boolean = false;
var isJumping:Boolean = false;
var jumpSpeedLimit:int = 14;
var jumpSpeed:Number = jumpSpeedLimit;
// END
public function main()
{
speed = 5;
kaas = new Kaas();
kaas.y = 300;
kaas.x = 300;
addChild(kaas);
ground = new Ground();
ground.y = stage.stageHeight;
ground.x = stage.stageWidth/2;
addChild(ground);
player = new Player();
player.x = stage.stageWidth/2 - player.width;
player.y = stage.stageHeight - 45;
player.width = 50;
player.height = 50;
addChild(player);
player.gotoAndStop("idle");
//event listeners.
stage.addEventListener(KeyboardEvent.KEY_UP, keyupCheck);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keydownCheck);
player.addEventListener(Event.ENTER_FRAME, movePlayer);
}
我希望有人能夠幫助我。
這是錯誤消息我得到:
typeerror error #1009 cannot access a property or method of a null object reference.at main()
由於提前, 雷米
你可以更新確切的錯誤信息你的問題? – davidethell
哦,對不起,我更新了:) –