# Dynamic path problem

**URL:** <https://forum.kirupa.com/t/dynamic-path-problem/111337>\
**Category:** Uncategorized\
**Created:** [May 26, 2004, 12:51am UTC](https://forum.kirupa.com/t/dynamic-path-problem/111337 "2004-05-26T00:51:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tedc](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@tedc](https://forum.kirupa.com/u/tedc)\
**Post date:** [May 26, 2004, 12:51am UTC](https://forum.kirupa.com/t/dynamic-path-problem/111337/1 "2004-05-26T00:51:16Z")

</div>

Hey again :-/ Im tying to target a path that is dynamic, haha that doesnt sound like it makes sense…

well I am trying to load a movie, I have several of them that are all on one frame (on different layers) and I have something like this:

[AS]  
Width = \_root.Content.Content1.\_width + 164;  
Height = \_root.Content.Content1.\_height;  
X = \_root.Content.Content1.\_x + 164;  
Y = \_root.Content.Content1.\_y;  
this.createEmptyMovieClip(“box”,2);  
box.lineStyle(1,0,1);  
box.beginFill(0xFFFFFF,100);  
box.moveTo(X,Y)  
box.lineTo(X,Height);  
box.lineTo(Width,Height);  
[/AS]

…etc etc…

BUT the problem is that the target for the Width, Height, X, and Y variables is not always Content.Content1… it actually depends on which button you press, so it might be Content.Content2 or 3 or 4 or 5, I think this is probably pretty simple but Im not sure of the syntax. The variable for the number is \_root.picture

I tried \_root.Content.Content + \_root.picture + .\_width for example, but it doesnt work. Also if I use quotes then it turns everything into a string instead of the value of the \_width. Am I making sense?

Appreciate all the help …

Ted

---

<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:** [May 26, 2004, 3:57am UTC](https://forum.kirupa.com/t/dynamic-path-problem/111337/2 "2004-05-26T03:57:53Z")

</div>

just make a variable for which number it should be (content x), and change it when you click on the buttons, then do this

```auto

path = "Content" + yourVariable;
Width = _root.Content[path]._width + 164;
//and so on like that ^^

```

What this does is make the path Content1 or Content2 or Content3 (etc) and then uses the Content movieClip as an object, which you then target to the path. It works pretty much like an array.

So your buttons should set yourVariable to 1 or 2 or whatever.

---

<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:** [May 26, 2004, 9:05am UTC](https://forum.kirupa.com/t/dynamic-path-problem/111337/3 "2004-05-26T09:05:39Z")

</div>

Hey hey what do you know, it works perfect hehe I dont understand it really. I thought it would be like:

\_root.Content.[Path].\_width;

or something like that, cause with

\_root.Content[Path].\_width

its almost like theres a dot missing or something haha… well whatever it works and thats what counts, thank you very much. Believe me I spent hours on hours trying to use the Eval function and all this stuff that didnt work :-/ Thanks again…

---

<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:** [May 26, 2004, 12:21pm UTC](https://forum.kirupa.com/t/dynamic-path-problem/111337/4 "2004-05-26T12:21:51Z")

</div>

Well, since Content (a movieclip) has all of that information in it (other mcs etc), you are basically calling them using it as an array in a sort. If you are familiar with an array, the way you get stuff out of it is array[x] where x is either a number or a label. It’s kind of a tricky concept I guess, but that’s what OOP is all about hehe 🙂  
(OOP = Object Oriented Programming). So no dot required.
