# Score counter in AS3

**URL:** <https://forum.kirupa.com/t/score-counter-in-as3/328790>\
**Category:** flash\
**Created:** [June 17, 2012, 11:07am UTC](https://forum.kirupa.com/t/score-counter-in-as3/328790 "2012-06-17T11:07:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chiapa](https://avatars.discourse-cdn.com/v4/letter/c/439d5e/32.png) [@chiapa](https://forum.kirupa.com/u/chiapa)\
**Post date:** [June 17, 2012, 11:07am UTC](https://forum.kirupa.com/t/score-counter-in-as3/328790/1 "2012-06-17T11:07:30Z")

</div>

Hi everyone,

The game I’m making is a shooter: alienships fly across the screen and when I click them, they die.

I want to have a dynamic text that keeps score of the number of ships I kill, but I’m not managing to do it.

I have a “Main class” and an “Alienship class” in my game. This code is in the “Alienship class”:

```
    function Alienship():void
    {
        addEventListener(MouseEvent.CLICK,whenclick);
    }

    private function whenclick(e:MouseEvent)
    {
        trace("You're dead

```

");  
parent.removeChild(this);  
}

It removes the alienship off the screen. But how can I have a variable that increments on each killing?

Thanks

Chiapa
