# Targeting duplicates II

**URL:** <https://forum.kirupa.com/t/targeting-duplicates-ii/57087>\
**Category:** Uncategorized\
**Created:** [July 10, 2004, 2:30am UTC](https://forum.kirupa.com/t/targeting-duplicates-ii/57087 "2004-07-10T02:30:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![guitarzen](https://avatars.discourse-cdn.com/v4/letter/g/5f9b8f/32.png) [@guitarzen](https://forum.kirupa.com/u/guitarzen)\
**Post date:** [July 10, 2004, 2:30am UTC](https://forum.kirupa.com/t/targeting-duplicates-ii/57087/1 "2004-07-10T02:30:12Z")

</div>

I attached a movie that I am working on. I use the duplicate actionscript to put several buttons on the stage when clicked. I then want to be able to use the color picker to change the background behind the buttons. As of right now it only works on 1 button and by changing the 6 in this code

for (i=1; i\<6; i++)

to 5, 4, 3, 2 or 1 it will only change that button. How can I get them all to change at once?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 10, 2004, 11:21am UTC](https://forum.kirupa.com/t/targeting-duplicates-ii/57087/2 "2004-07-10T11:21:29Z")

</div>

For your tab button:

```auto
on (release) {
	_root.bb.gotoAndStop(4);
	var amount = 6;
	_root.bb._x = 50;
	_root.bb._y = 100;
	_root.bb._xscale = _root.bb._yscale=90;
	//duplicate 6 times
	for (var i = 0; i<amount; i++) {
		_root.bb.t1.duplicateMovieClip("ball"+i, i);
		//set the original invisible
		_root.bb.t1._visible = 0;
		_root.bb["ball"+i]._x = 101*i;
	}
}

```

and in the as layer of the panel buttons mc:

```auto
colorBtn.onPress = function() {
	colorBox._visible = !colorBox._visible;
};
colorBtn.useHandCursor = false;
function myHandler(component) {
	for (i=0; i<6; i++) {
		myColor = new Color(_root.bb["ball"+i].screen);
		myColor.setRGB(component.getRgbValue());
	}
	component._visible = false;
}
colorBox.setChangeHandler("myHandler");

```

scotty(-:
