Help to score counter

I have some problems making a score counter in my flash 8 movie, so I hope somebody can help me!
The score counter should give the player a point, each time the player reach frame 40 or 50 in my movie.
First I created one dynamic textfield on frame 1 and called it scorecounter in the var field.
Then I wrote this code in frame one of my movie:
scorecounter = 0;

After this I wrote this code on frame 40 and 50:

onEnterFrame = function {
scorecounter++; //by the way it doesn`t help if I write: _root.scorecounter += 1 or ++;
}

but nothing happens when the movie enters frame 40 or 50. Anybody who knows why?