# String to path

**URL:** <https://forum.kirupa.com/t/string-to-path/296413>\
**Category:** Uncategorized\
**Created:** [September 14, 2009, 8:27pm UTC](https://forum.kirupa.com/t/string-to-path/296413 "2009-09-14T20:27:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrickjv](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@patrickjv](https://forum.kirupa.com/u/patrickjv)\
**Post date:** [September 14, 2009, 8:27pm UTC](https://forum.kirupa.com/t/string-to-path/296413/1 "2009-09-14T20:27:07Z")

</div>

I have a path (String variable called “nowpath”) where a value is pushed into temporarily, for instance ui.par1.blocktint  
The specic movieclip on the end of the path (blocktint) has a function implementback() and if I directly test out

```auto
test3 = _root.ui.par1.blocktint;
test3.implementback();

```

It executes this function. That works properly. But not when trying

```auto
test3 = "_root."+nowpath;
test3.implementback();

```

So I started testing with square brackets, for instance directly testing

```auto
test3 = _root["ui"]["par1"]["blocktint"];
test3.implementback();

```

Works as well. So I split the path with an extra function to imediately rejoin into variable “ob”

```auto
 var results:Array = nowpath.split(".");
 for(j=0;j<results.length-1;j++){
  ob += '["'+ results[j] + '"]'
 }

```

So that “ob” outputs like [“ui”][“par1”][“blocktint”] and then I try

```auto
test3 = "_root"+ob;
test3.implementback();

```

Still no luck. I’m having a lot of dificulties concatenating the test3 from “\_root” and the nowpath variable

Anybody any clue what goes wrong?  
t.i.a  
P
