# Accessing a Child Movieclip Name?

**URL:** <https://forum.kirupa.com/t/accessing-a-child-movieclip-name/265036>\
**Category:** Uncategorized\
**Created:** [July 3, 2008, 7:31am UTC](https://forum.kirupa.com/t/accessing-a-child-movieclip-name/265036 "2008-07-03T07:31:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![websmythe](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/websmythe/32/3129_2.png) [@websmythe](https://forum.kirupa.com/u/websmythe)\
**Post date:** [July 3, 2008, 7:31am UTC](https://forum.kirupa.com/t/accessing-a-child-movieclip-name/265036/1 "2008-07-03T07:31:56Z")

</div>

Hi. I have a child movieclip within a movieclip on the stage, eg; _flowerpot.flower1,_ that I want to dynaimcally unload, and randomly attach one of a couple of other clips from the library, eg: \*flower2 or flower3. \*

I read in help that\* \_parent.MovieClip \*will retrieve a reference to parent clip. Is there a property or function/method that will retrieve a reference to a child clip, from which i can access the name? Not sure where to look.

[COLOR=#0066cc]Thanx.[/COLOR]

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [July 3, 2008, 2:40pm UTC](https://forum.kirupa.com/t/accessing-a-child-movieclip-name/265036/2 "2008-07-03T14:40:43Z")

</div>

[quote=websmythe;2352920]Hi. I have a child movieclip within a movieclip on the stage, eg; _flowerpot.flower1,_ that I want to dynaimcally unload, and randomly attach one of a couple of other clips from the library, eg: \*flower2 or flower3. \*

I read in help that\* \_parent.MovieClip \*will retrieve a reference to parent clip. Is there a property or function/method that will retrieve a reference to a child clip, from which i can access the name? Not sure where to look.

[COLOR=#0066cc]Thanx.[/COLOR][/quote]  
movieclip.\_name :x

---

<div class="post-metadata">

**Author:** ![websmythe](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/websmythe/32/3129_2.png) [@websmythe](https://forum.kirupa.com/u/websmythe)\
**Post date:** [July 3, 2008, 5:09pm UTC](https://forum.kirupa.com/t/accessing-a-child-movieclip-name/265036/3 "2008-07-03T17:09:36Z")

</div>

> [@nathan99;2353081](#):
>
> movieclip.\_name :x

Duh! Guess i could take off my shades now.  
Looked for it, and didn’t see it in the help.  
Thanx.

K… so, have I missed something with _SetProperty(),_ I copied it outta help. And… didn’t read anywhere that ._\_name_ was read-only ??

-Dazed & Confused …LOL

* * *

[Output]  
myParent.target\_mc.\_name = target\_mc  
myParent.target\_mc.\_name = undefined  
myParent.target\_mc.\_name = undefined  
[/Output]

```auto
// Display and change target_mc._name inside of myParent_mc 
// Instance name of parent movieclip = myParent_mc
// Instance name for child movieclip = target_mc
// target_mc is behind a mask. Not that it should matter... 
 
trace("myParent.target_mc._name = " + myParent_mc.target_mc._name );
 
setProperty( myParent_mc.target_mc, _name, "Flower1" );
 trace( "myParent.target_mc._name = " + myParent_mc.target_mc._name );
 
setProperty( myParent_mc.target_mc, _name, "Flower2" );
 trace( "myParent.target_mc._name = " + myParent_mc.target_mc._name );

```

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [July 4, 2008, 4:51am UTC](https://forum.kirupa.com/t/accessing-a-child-movieclip-name/265036/4 "2008-07-04T04:51:29Z")

</div>

myParent.target\_mc.\_name = “newName” should work

---

<div class="post-metadata">

**Author:** ![websmythe](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/websmythe/32/3129_2.png) [@websmythe](https://forum.kirupa.com/u/websmythe)\
**Post date:** [July 4, 2008, 5:11am UTC](https://forum.kirupa.com/t/accessing-a-child-movieclip-name/265036/5 "2008-07-04T05:11:40Z")

</div>

Na. No such luck. Go figure.  
I included the _fla_ this time just in case I’d not placed things right.  
-Mystified

[Output]  
myParent\_mc.target\_mc.\_name = target\_mc  
myParent\_mc.target\_mc.\_name = undefined  
[/Output]

```auto
trace("myParent_mc.target_mc._name = " + myParent_mc.target_mc._name );
myParent_mc.target_mc._name = "Flower1";
trace("myParent_mc.target_mc._name = " + myParent_mc.target_mc._name );

```

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [July 4, 2008, 8:20am UTC](https://forum.kirupa.com/t/accessing-a-child-movieclip-name/265036/6 "2008-07-04T08:20:58Z")

</div>

```auto
trace("myParent_mc.target_mc._name = " + myParent_mc.target_mc._name );
    
//setProperty(myParent_mc.target_mc, _name, "Flower1");
myParent_mc.target_mc._name = "Flower1"
trace("myParent_mc.target_mc._name = " + myParent_mc.Flower1._name );

```

Once you rename it, you have to call the new path, with the changed name

---

<div class="post-metadata">

**Author:** ![websmythe](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/websmythe/32/3129_2.png) [@websmythe](https://forum.kirupa.com/u/websmythe)\
**Post date:** [July 4, 2008, 2:17pm UTC](https://forum.kirupa.com/t/accessing-a-child-movieclip-name/265036/7 "2008-07-04T14:17:00Z")

</div>

I’m gonna definately have to wake up.  
Thanx.
