# A really simple question

**URL:** <https://forum.kirupa.com/t/a-really-simple-question/6906>\
**Category:** flash\
**Created:** [October 19, 2002, 2:04pm UTC](https://forum.kirupa.com/t/a-really-simple-question/6906 "2002-10-19T14:04:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![FLATLINE\_\_](https://avatars.discourse-cdn.com/v4/letter/f/f07891/32.png) [@FLATLINE\_\_](https://forum.kirupa.com/u/FLATLINE__)\
**Post date:** [October 19, 2002, 2:04pm UTC](https://forum.kirupa.com/t/a-really-simple-question/6906/1 "2002-10-19T14:04:58Z")

</div>

How do I turn strings contained in a variable to numeric/non strings?

For example:

This is what I have:

milk = “hello”;

And I want to turn the “hello” into hello.

milk = “hello”;  
milk = hello;

See the difference? So lets say I don’t know what is in milk, but I know it’s a string and I don’t want it to be a string (for example for using it in gotoAndPlay functions to tell instance names). How do I do it?

Thanks in advance.

---

<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:** [October 19, 2002, 3:36pm UTC](https://forum.kirupa.com/t/a-really-simple-question/6906/2 "2002-10-19T15:36:13Z")

</div>

You can do that even if milk = “hello”, just use gotoAndPlay[milk] to get the content of the variable. (equals to gotoAndPlay(hello) )

---

<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:** [October 20, 2002, 5:19am UTC](https://forum.kirupa.com/t/a-really-simple-question/6906/3 "2002-10-20T05:19:03Z")

</div>

er… no, that’s not what I ment.  
I ment doing something like this:

\_parent.\_root.milk.anothermc.gotoAndPlay(“blabla”);

Where \_root.milk is a variable, if it contains a string it won’t work.

---

<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:** [October 20, 2002, 7:50am UTC](https://forum.kirupa.com/t/a-really-simple-question/6906/4 "2002-10-20T07:50:25Z")

</div>

I don’t understand. If you write \_root.milk.anothermc, it means that milk is an mc, right? Not a string. Or maybe you’re meaning that the string contained in milk is the name of the movie clip??

pom :q: :q:

---

<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:** [October 20, 2002, 12:59pm UTC](https://forum.kirupa.com/t/a-really-simple-question/6906/5 "2002-10-20T12:59:02Z")

</div>

Yes! Exactly! The string contained in \_root.milk is a name of a movie clip! But if it’s a string it won’t work!

Look:

\_root.target = thebox;

thebox is NOT a predefined variable, it’s the name of a movieclip which is later used like this, and it works:

\_parent.\_root.target.insider.gotoAndPlay(“yada”);

However:

\_root.target = \_parent.\_name;

Will put in \_root.target the name of the parent MC as a STRING, and this will NOT WORK:

\_parent.\_root.target.insider.gotoAndPlay(“blah”);

---

<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:** [October 20, 2002, 1:04pm UTC](https://forum.kirupa.com/t/a-really-simple-question/6906/6 "2002-10-20T13:04:41Z")

</div>

Oh sorry, target is a function thing in Flash, so umm… Just imagine it’s \_root.trgt instead or something.

---

<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:** [October 20, 2002, 2:40pm UTC](https://forum.kirupa.com/t/a-really-simple-question/6906/7 "2002-10-20T14:40:13Z")

</div>

No need to use \_parent AND \_root, flat…

And use the [], like that:  
\_root[target].insider.gotoAndPlay(“there”);

pom :cowboy:

---

<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:** [October 20, 2002, 8:58pm UTC](https://forum.kirupa.com/t/a-really-simple-question/6906/8 "2002-10-20T20:58:00Z")

</div>

I think you still didn’t understand what I was trying to say…

I NEED that \_parent, because it’s some instance targeting sh\*t.

```
[root]
  |

```

_**[boombang]**_\_\_\_\_\_  
| | |  
| | |  
[actiondoer] [thebox] [circle]  
| |  
[insider] [insider]

[actiondoer], [thebox] and [circle] are all movie clips inside another movieclip named [boombang] which is on the main stage. Both [insider] movie clips are either inside [thebox] or [circle]. Sorry that you can’t see it here, looks like IE doesn’t support tab spaces. Try quoting my post.

[actiondoer] is where the script is, and I need to tell [insider] to gotoAndPlay somewhere. I’m doing something like this if I know that the target is thebox:

\_parent.thebox.insider.gotoAndPlay

But if the instance name is inside a root variable named \_root.milk?

If I did something like this:  
\_root.milk = thebox;

Then this will work:  
\_parent.\_root.milk.insider.gotoAndPlay

But if I execute this script from inside [insider]:  
\_root.milk = \_parent.\_name

Then this won’t work because \_root.milk is a string like “thebox”:  
\_parent.\_root.milk.insider.gotoAndPlay

---

<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:** [October 20, 2002, 10:17pm UTC](https://forum.kirupa.com/t/a-really-simple-question/6906/9 "2002-10-20T22:17:05Z")

</div>

What I said: \_parent[\_root.milk].insider.gotoAndPlay  
It should work.

pom :asian:

---

<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:** [October 21, 2002, 5:19pm UTC](https://forum.kirupa.com/t/a-really-simple-question/6906/10 "2002-10-21T17:19:49Z")

</div>

Hmm I tried it and it worked. Thanks Pom! Guess I was wrong about the way Flash is working with instance[variable].

Thanks again!
