# Accessing a MC instance name from a text field, and playing it

**URL:** <https://forum.kirupa.com/t/accessing-a-mc-instance-name-from-a-text-field-and-playing-it/214472>\
**Category:** Uncategorized\
**Created:** [January 29, 2007, 10:29am UTC](https://forum.kirupa.com/t/accessing-a-mc-instance-name-from-a-text-field-and-playing-it/214472 "2007-01-29T10:29:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nizamm](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/nizamm/32/7613_2.png) [@nizamm](https://forum.kirupa.com/u/nizamm)\
**Post date:** [January 29, 2007, 10:29am UTC](https://forum.kirupa.com/t/accessing-a-mc-instance-name-from-a-text-field-and-playing-it/214472/1 "2007-01-29T10:29:18Z")

</div>

I have a MC with an instance name, ‘JOE’.

I have a dynamic text field with an instance name, ‘EMP\_NAME’.

The text field is set to “” default.

Upon runtime, I assign a text value of ‘JOE’ into ‘EMP\_NAME’.

Hence, \_root.EMP\_NAME.text = “JOE”;

Once that’s done, I want the MC to check the text in ‘EMP\_NAME’, and play if the text is ‘JOE’.

As of now, I have an ‘if’ statement to do that check. Since I’m going to have many MCs I do not want to add more ‘if’ statements or ‘switch’ cases as that would simply be hardcoding. I want to add more MCs with unique instance names like ‘JOE’, ‘RICK’, ‘PAT’ etc. and should correspondingly play the MC whose instance name matches to that assigned to ‘EMP\_NAME’ directly and not with a condition.

Ideally speaking, though the syntax is incorrect, this is what I’m trying to do:

```auto
[COLOR=RoyalBlue]_root.emp_name.text.gotoAndPlay(10); [/COLOR][COLOR=Green] //which is incorrect[/COLOR]

```

alternatively,

```auto
[COLOR=RoyalBlue]var instance_name = _root.holder.text;
_root.instance_name.gotoAndPlay(10);[/COLOR] [COLOR=Green]// which is also incorrect.[/COLOR]

```

So, is there a one liner code that would directly play the corresponding movie clip once after having read its instance name from the dynamic text field, WITHOUT a conditional statement?

Me make sense?
