Scoring

I used the code i found here
http://www.kirupa.com/developer/mx/score.htm
to create some simple scoring.
It works fine but when i drop it on a fla im working on, the text box thats supposed to show the score displays the text ‘NaN’ instead of the score.
What could possibly be wrong.

heres the original code

on (release) {  	_root.total = _root.total + 100;  }

and heres what i edited it to be (im doing some drag and drop stuff

on (release) {
		stopDrag();
		if (this._droptarget=="/male") {
		setProperty(this, _x, 306.0);
		setProperty(this, _y, 65.0);
		_root.sob.gotoAndPlay ("happy");
                 _root.total = _root.total + 100
	}

This code is on a button by the way

have you tried changing the var field in the text box to _root.total because otherwise there is no change to the variable in your updated code…

Prophet.

the first action you should have is to set the variable to 0:

total = 0;

now you can add 100 units every time you want:

on (release) {
		stopDrag();
		if (this._droptarget=="/male") {
		setProperty(this, _x, 306.0);
		setProperty(this, _y, 65.0);
		_root.sob.gotoAndPlay ("happy");
                 total+=100;//here we add 100
	}