# AS3 ending a game

**URL:** <https://forum.kirupa.com/t/as3-ending-a-game/321820>\
**Category:** flash\
**Created:** [May 2, 2011, 2:20pm UTC](https://forum.kirupa.com/t/as3-ending-a-game/321820 "2011-05-02T14:20:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mediawhale](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@mediawhale](https://forum.kirupa.com/u/mediawhale)\
**Post date:** [May 2, 2011, 2:20pm UTC](https://forum.kirupa.com/t/as3-ending-a-game/321820/1 "2011-05-02T14:20:40Z")

</div>

I need help ending a piece only when all the buttons are clicked. Here’s the code I have.Also I’m new to this, a laymen explanation would be much appreciated. I want to actually learn how this is done.

```auto
stop ();

nature.addEventListener(MouseEvent.CLICK, buttonClick);
function buttonClick(event:MouseEvent):void{
gotoAndPlay("label 1");
}

scientific.addEventListener(MouseEvent.CLICK, buttonClick2);
function buttonClick2(event:MouseEvent):void{
gotoAndPlay("label 2");
}

freelance.addEventListener(MouseEvent.CLICK, buttonClick3);
function buttonClick3(event:MouseEvent):void{
gotoAndPlay("label 3");
}

commercial.addEventListener(MouseEvent.CLICK, buttonClick4);
function buttonClick4(event:MouseEvent):void{
gotoAndPlay("label 4");
}

art.addEventListener(MouseEvent.CLICK, buttonClick5);
function buttonClick5(event:MouseEvent):void{
gotoAndPlay("label 5");
}

travel.addEventListener(MouseEvent.CLICK, buttonClick6);
function buttonClick6(event:MouseEvent):void{
gotoAndPlay("label 6");
}

graphic.addEventListener(MouseEvent.CLICK, buttonClick7);
function buttonClick7(event:MouseEvent):void{
gotoAndPlay("label 7");
}

law.addEventListener(MouseEvent.CLICK, buttonClick8);
function buttonClick8(event:MouseEvent):void{
gotoAndPlay("label 8");
}

publish.addEventListener(MouseEvent.CLICK, buttonClick9);
function buttonClick9(event:MouseEvent):void{
gotoAndPlay("label 9");
}

```
