# Error #1009 ... Seriously annoying ... Please help!

**URL:** <https://forum.kirupa.com/t/error-1009-seriously-annoying-please-help/255888>\
**Category:** flash\
**Created:** [March 27, 2008, 10:37pm UTC](https://forum.kirupa.com/t/error-1009-seriously-annoying-please-help/255888 "2008-03-27T22:37:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LauraITT](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@LauraITT](https://forum.kirupa.com/u/LauraITT)\
**Post date:** [March 27, 2008, 10:37pm UTC](https://forum.kirupa.com/t/error-1009-seriously-annoying-please-help/255888/1 "2008-03-27T22:37:27Z")

</div>

Hi every1,  
I have an error that is really buggin me ! You know error # 1009 - null object refernece (Somthing like that ne way!) I debugged it and the lines in quotes are the 1’s giving errors. Here is the code:  
// scroll to the right or left if needed  
public function scrollWithHero(){

> var stagePosition:Number = gamelevel.x+hero.mc.x;

var rightEdge:Number = stage.stageWidth-edgeDistance;  
var leftEdge:Number = edgeDistance;  
if (stagePosition \> rightEdge) {  
gamelevel.x -= (stagePosition-rightEdge);  
if (gamelevel.x \< -(gamelevel.width-stage.stageWidth)) gamelevel.x = -(gamelevel.width-stage.stageWidth);  
}  
if (stagePosition \< leftEdge) {  
gamelevel.x += (leftEdge-stagePosition);  
if (gamelevel.x \> 0) gamelevel.x = 0;  
}  
}

And this is the other piece of code:  
// perform all game tasks  
public function gameLoop(event:Event) {  
// get time differentce  
if (lastTime == 0) lastTime = getTimer();  
var timeDiff:int = getTimer()-lastTime;  
lastTime += timeDiff;

// only perform tasks if in play mode  
if (gameMode == “play”) {  
moveCharacter(hero,timeDiff);  
moveEnemies(timeDiff);  
checkCollisions();

> scrollWithHero();

}  
}  
I really dont get why its giving this as I have code so that when the character gets 90 points to goto frame 4 and this error pops up then. Ne ideas what the problem is ???  
Thanks in advanve
