# All buttons are clicked

**URL:** <https://forum.kirupa.com/t/all-buttons-are-clicked/328923>\
**Category:** Uncategorized\
**Created:** [July 3, 2012, 8:06am UTC](https://forum.kirupa.com/t/all-buttons-are-clicked/328923 "2012-07-03T08:06:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eva\_tw](https://avatars.discourse-cdn.com/v4/letter/e/ec9cab/32.png) [@eva\_tw](https://forum.kirupa.com/u/eva_tw)\
**Post date:** [July 3, 2012, 8:06am UTC](https://forum.kirupa.com/t/all-buttons-are-clicked/328923/1 "2012-07-03T08:06:20Z")

</div>

Hi!

I’ve made serveral buttons, which display text if they’re clicked. When all the buttons are clicked, a movieclip has to become visible. In code I’ve come to this, but I can’t get the ckeck-function right (below). It seems to me that I’ve done everything right, but it doesn’t work properly… How can I get it working?

Thanks!

```auto

var txtArray:Array = [txt_begin, txt_appel, txt_peer, txt_banaan];
var btnArray:Array = [begin, appel, peer, banaan];
var vinkArray:Array = [1, 0, 0, 0];

txt_begin.visible = true;
mc_vinkje.visible = false;

for(var i:int = 0; i < txtArray.length; i++) 
	{
	txtArray*.visible = false;
	txt_begin.visible = true;
	}

for(var j:int = 0; j < btnArray.length; j++) 
	{
	btnArray[j].visible = true;
	btnArray[j].addEventListener(MouseEvent.MOUSE_DOWN, onBTNklik);
	begin.visible = false;
	}

function onBTNklik (event:MouseEvent):void
	{
	
	var len:uint = Math.min(txtArray.length,vinkArray.length);
	for(var i:int = 0; i < len; i++)

		txtArray*.visible = false;
		begin.visible = true;
		vinkArray*++;

		var currentBTN:String = event.currentTarget.name;
		var currentTXT:DisplayObject = getChildByName ("txt_" + currentBTN);
		
		if (txtArray* == btnArray*)
			{
			currentTXT.visible = true;
			}
		
		if (currentTXT == txt_begin)
			{
			begin.visible = false;
			}
		
		vinkcheck();

	}
	

function vinkcheck ():void
	{
	for(var i:int = 0; i < vinkArray.length; i++) 
		
		if (vinkArray[1] != 0)
			{
			mc_vinkje.visible = true;
			}
	}

```

It is now programmed that the MC should become visible when just one button is clicked, but it should be all three. I just wanted to test it with one, but even that doesn’t work.
