I’m trying to make a quiz in Flash, and I want to count how many points you get. I’m having each page in my quiz in a new scene (because my teacher said I should), and in the first scene i have defined a global counter:
_global.counter=0;
In scene two, I have a drag and drop task. The task itself works, when I put the right object in the right place I can see that it works, but I don’t know if it counts point for it. In the code for each object I have a line so it should count one point when the object is placed right. For example:
};
villa.onPress = function():Void {
this.startDrag(true);
svar.text = "move the object to the right place";
};
villa.onRelease = function():Void {
this.stopDrag();
if (eval(this._droptarget) == villatarget) {
svar.text="that's right!";
** [COLOR=Red]counter = counter + 1;[/COLOR]**
}
else {
svar.text="sorry, try again";
}
The counter = counter + 1; line here should do it, I think.
In the last scene I have a dynamic text field with counterout as an instance name, and the code:
counterout.text = counter;
Still, the there’s no text in the text field after I finished the drag and drop task… What am I doing wrong?