# Is there a way to give actions to movieclip with no instance name?

**URL:** <https://forum.kirupa.com/t/is-there-a-way-to-give-actions-to-movieclip-with-no-instance-name/265970>\
**Category:** flash\
**Created:** [July 15, 2008, 2:36am UTC](https://forum.kirupa.com/t/is-there-a-way-to-give-actions-to-movieclip-with-no-instance-name/265970 "2008-07-15T02:36:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Line](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@Line](https://forum.kirupa.com/u/Line)\
**Post date:** [July 15, 2008, 2:36am UTC](https://forum.kirupa.com/t/is-there-a-way-to-give-actions-to-movieclip-with-no-instance-name/265970/1 "2008-07-15T02:36:04Z")

</div>

Is there a way to give actions to movieclip with no instance name?

Can I just say \_root.movieclipname.gotoAndStop(2);

where movieclipname is the actual name of the movieclip symbol on the stage?

-Line

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [July 15, 2008, 2:38am UTC](https://forum.kirupa.com/t/is-there-a-way-to-give-actions-to-movieclip-with-no-instance-name/265970/2 "2008-07-15T02:38:17Z")

</div>

No, why?

---

<div class="post-metadata">

**Author:** ![Line](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@Line](https://forum.kirupa.com/u/Line)\
**Post date:** [July 15, 2008, 2:40am UTC](https://forum.kirupa.com/t/is-there-a-way-to-give-actions-to-movieclip-with-no-instance-name/265970/3 "2008-07-15T02:40:20Z")

</div>

I have like 300 something movieclips named box1, box2, box3 and I want to make them all change color with hitTest’s but I don’t really want to name all the instance names of all 300 boxes.

-Line

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [July 15, 2008, 2:45am UTC](https://forum.kirupa.com/t/is-there-a-way-to-give-actions-to-movieclip-with-no-instance-name/265970/4 "2008-07-15T02:45:51Z")

</div>

1. You already named 300 different symbols, what’s 300 instance names?
2. Why do you need 300 different symbols, seems excessive. Is each one really different?
3. You should add them all with AS.
4. If all else fails you can write a JSFL script but I don’t think it should have to come to that.

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [July 15, 2008, 12:36pm UTC](https://forum.kirupa.com/t/is-there-a-way-to-give-actions-to-movieclip-with-no-instance-name/265970/5 "2008-07-15T12:36:08Z")

</div>

you could put code inside the symbol itself…  
otherwise you can use a for…in loop in the timeline in which they exist and check for typeof == “movieclip” and then apply actions to each one you find that way. Of course if you have movie clips you don’t want to give actions to, that could be a problem. You’d have to identify them.

---

<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 15, 2008, 1:02pm UTC](https://forum.kirupa.com/t/is-there-a-way-to-give-actions-to-movieclip-with-no-instance-name/265970/6 "2008-07-15T13:02:27Z")

</div>

dont they get names like Instance0, Instance1 etc? or can’t you put actions to them?

---

<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 15, 2008, 1:07pm UTC](https://forum.kirupa.com/t/is-there-a-way-to-give-actions-to-movieclip-with-no-instance-name/265970/7 "2008-07-15T13:07:51Z")

</div>

yeah it does; I put an MC on the frame, place the following in the actions and it works

```auto
instance1.a = 1978
trace(instance1.a)
instance1.onPress= function():Void{
	trace(this.a)
}

```
