Adding to variable from within movieclip

Using AS 3.0 I have declared a variable on the maintimeline
var thescore:int=0;

From within a movieclip I now want to increase the value of that variable and display it in a text box.

var thescore:int=thescore+10;
Object(root).myscore.text=thescore.toString();

The above code only displays ten and doesn’t increase when the movieclip loops.

If I change the code to
thescore=thescore+10;
Object(root).myscore.text=thescore.toString();

I receive an error undefine property

Any help would be appreciated.