# Set a maximum to check boxes

**URL:** <https://forum.kirupa.com/t/set-a-maximum-to-check-boxes/312499>\
**Category:** flash\
**Created:** [August 5, 2010, 4:20am UTC](https://forum.kirupa.com/t/set-a-maximum-to-check-boxes/312499 "2010-08-05T04:20:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eddie\_E](https://avatars.discourse-cdn.com/v4/letter/e/2acd7d/32.png) [@Eddie\_E](https://forum.kirupa.com/u/Eddie_E)\
**Post date:** [August 5, 2010, 4:20am UTC](https://forum.kirupa.com/t/set-a-maximum-to-check-boxes/312499/1 "2010-08-05T04:20:44Z")

</div>

I have question I use for my website that users can select a few items and I then record what they have selected. The problem is I’m not sure how to add a maximum check of 3 to my array of items? Does anyone have the knowledge to edit the below script to add this restriction?

```auto
 item.hit.onRelease = function() {
			var item:MovieClip = this._parent;
			
			if (!item.checked) {
				if (item.index == itemArray.length-1) {
					for (var i=0; i<itemArray.length; i++) {
						item_holder["item"+i].checked = false;
						item_holder["item"+i].gotoAndStop(1);
						_root.valueC(i, 0);
						trace("_root.valueC(" + i + ", 0);");
						itemArrayH* = 0;
					}
				}
					if (item.index != itemArray.length-1) {
					item_holder["item"+(itemArray.length-1)].checked = false;
					item_holder["item"+(itemArray.length-1)].gotoAndStop(1);
					_root.valueC((itemArray.length-1), 0);
					trace("_root.valueC(" + (itemArray.length-1) + ", 0);");
					itemArrayH[(itemArray.length-1)] = 0;
				}
				item.checked = true;
				item.gotoAndStop(3);
				_root.valueC(item.index, 1);
				trace("_root.valueC(" + item.index + ", 1);");
				itemArrayH[item.index] = 1;
			}
			else {
				item.checked = false;
				item.gotoAndStop(1);
				_root.valueC(item.index, 0);
				trace("_root.valueC(" + item.index + ", 0);");
				itemArrayH[item.index] = 0;
			}
			_root.suppliers = itemArrayH;
			trace(itemArrayH);
		};
	}

```

Thanks

Eddie
