A really simple question

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.

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

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


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

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:

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!


_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:



_root.target = _parent._name;

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


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

No need to use _parent AND _root, flat…

And use the [], like that:

pom :cowboy:

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.


| | |
| | |
[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:


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:

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”:

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

pom :asian:

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

Thanks again!