# Help! How to Keep & Display score for Drag & Drop Game?

**URL:** <https://forum.kirupa.com/t/help-how-to-keep-display-score-for-drag-drop-game/232362>\
**Category:** Uncategorized\
**Created:** [July 13, 2007, 3:21am UTC](https://forum.kirupa.com/t/help-how-to-keep-display-score-for-drag-drop-game/232362 "2007-07-13T03:21:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![suriaz20](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@suriaz20](https://forum.kirupa.com/u/suriaz20)\
**Post date:** [July 13, 2007, 3:21am UTC](https://forum.kirupa.com/t/help-how-to-keep-display-score-for-drag-drop-game/232362/1 "2007-07-13T03:21:26Z")

</div>

I need your kind help urgently.;(

I need to create a simple drag and drop game. If the object is dropped to the correct location, the score will be displayed (e.g. 3 out of 4 right!).

I managed to create the drag and drop and snapped it at the right location.

But, am unable to keep and display the score.

I have minimal AS knowledge so the code below was taken from other sites. (I do know the meaning of instance names, and some basic actions though)

## Anyone can help???

**This is my actionscript applied for the object called “paper” -**

onClipEvent (load) {  
origX = this.\_x;  
origY = this.\_y;  
}

onClipEvent (mouseDown) {  
if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse)) {  
this.startDrag();  
}  
}  
onClipEvent (mouseUp) {  
if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse)) {  
this.stopDrag();  
}  
// see if the dropZone contains the center of this mc  
if (\_parent.plastic.hitTest(this.\_x,this.\_y,true)) {

// center it on the drop zone  
this.\_x = \_parent.plastic.\_x;  
this.\_y = \_parent.plastic.\_y;

[COLOR=red]// this part here, I did on my own…just an assumption that it might  
work but didn’t[/COLOR]  
[COLOR=navy]var total=1;  
total++;  
score.text=“You scored " + total +” out of 4";[/COLOR]  
}  
else {  
// return it to its original location  
this.\_x = origX;  
this.\_y = origY;  
}

}
