# Setting property of duplicated component?

**URL:** https://forum.kirupa.com/t/setting-property-of-duplicated-component/62804
**Category:** Uncategorized
**Created:** [August 31, 2004, 1:08pm UTC](https://forum.kirupa.com/t/setting-property-of-duplicated-component/62804 "2004-08-31T13:08:38Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![bape](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bape](https://forum.kirupa.com/u/bape)
#### Post date: [August 31, 2004, 1:08pm UTC](https://forum.kirupa.com/t/setting-property-of-duplicated-component/62804/1 "2004-08-31T13:08:38Z")

</div>

hi there, ive got a radiobutton component on my stage named radio1.  
I need to duplicate it and then change a few properties, but i cant seem to get the path/naming right. This is my code:

```auto

i=2;
radio1.duplicateMovieClip("radio"+i, radio1.getNextHighestDepth(), {_x:20, _y:20});
_root["radio"+i].setLabel("test");
i++

```

if i use a constant name instead of “radio”+i it works but the [“radio”+i] seems to be the problem, could someone help me with this? (using flash mx)

---

<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: [August 31, 2004, 6:06pm UTC](https://forum.kirupa.com/t/setting-property-of-duplicated-component/62804/2 "2004-08-31T18:06:25Z")

</div>

shouldnt it be:

```auto
i=2;
duplicateMovieClip(radio1,"radio"+i, radio1.getNextHighestDepth(), {_x:20, _y:20});
_root["radio"+i].setLabel("test");
i++

```

?? try that an lemme know (im usin FMX so mite b slightly diff in FMX2004… for instance i dont have the _getNextHighestDepth()_ function ☹ )

Prophet.

---

<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: [September 1, 2004, 10:46am UTC](https://forum.kirupa.com/t/setting-property-of-duplicated-component/62804/3 "2004-09-01T10:46:13Z")

</div>

duplication works fine as it is, only this part doesnt work:  
\_root[“radio”+i].setLabel(“test”);

Its about the \_root[“radio”+i] , this doenst work but i dont know why. Cause its an component? could someone please help…

---

<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: [September 1, 2004, 5:46pm UTC](https://forum.kirupa.com/t/setting-property-of-duplicated-component/62804/4 "2004-09-01T17:46:46Z")

</div>

if duplication was working correctly then so should that

Prophet.

---

<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: [September 13, 2004, 10:42am UTC](https://forum.kirupa.com/t/setting-property-of-duplicated-component/62804/5 "2004-09-13T10:42:39Z")

</div>

It still doesnt work, as i said, duplication works (a duplicate of the instance in question appears) only setting the property is failing…

---

<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: [September 13, 2004, 12:07pm UTC](https://forum.kirupa.com/t/setting-property-of-duplicated-component/62804/6 "2004-09-13T12:07:27Z")

</div>

Radiobutton doesnt have a setLabel() method;

use

```auto
 RadioButtonInstanceName.label = "some Text"; 

```

---

<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: [September 13, 2004, 1:51pm UTC](https://forum.kirupa.com/t/setting-property-of-duplicated-component/62804/7 "2004-09-13T13:51:55Z")

</div>

> [@nishanthe](#):
>
> Radiobutton doesnt have a setLabel() method;
> 
> use
> 
> ```auto
> RadioButtonInstanceName.label = "some Text"; 
> 
> ```

nope, not working either

---

<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: [September 21, 2004, 9:41am UTC](https://forum.kirupa.com/t/setting-property-of-duplicated-component/62804/8 "2004-09-21T09:41:27Z")

</div>

it should work,  
check the instance name…
