# Eval () / path problem

**URL:** <https://forum.kirupa.com/t/eval-path-problem/58647>\
**Category:** Uncategorized\
**Created:** [July 24, 2004, 1:36pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647 "2004-07-24T13:36:46Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_Vulcan](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/the_vulcan/32/145_2.png) [@The\_Vulcan](https://forum.kirupa.com/u/The_Vulcan)\
**Post date:** [July 24, 2004, 1:36pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/1 "2004-07-24T13:36:46Z")

</div>

Ok I had this code on the same level as **[color=blue]“ring”[/color]**

```php
for(i=0;i<=10;i++){
if (this["writename"+i] == undefined) {
eval("ring"+i)._visible = false; 
eval("ring"+i).writename.text = "";
}else{
eval["ring"+i]._visible = true; 
eval["ring"+i].writename.text = this["writename"+i]; }}

```

Now I have placed **[color=blue]“ring”[/color]** in a movie called **[color=blue]“box”[/color]**  
And **[color=blue]“box”[/color]** is loaded into [color=blue] **“scrol”** [/color] (scrollpane)

This is how I thought the code should be, but it doesn’t work.

```php
for(i=0;i<=10;i++){
if (this["writename"+i] == undefined) {
scrol.box.eval("ring"+i)._visible = false; 
eval("ring"+i).writename.text = "";
}else{
scrol.box.eval["ring"+i]._visible = true; 
scrol.box.eval["ring"+i].writename.text = this["writename"+i]; }}

```

**Any ideas ?**

---

<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:** [July 24, 2004, 7:09pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/2 "2004-07-24T19:09:43Z")

</div>

eval doesn’t work with []  
either you use the brackets i.e.:  
\_root.abc[“def”].ghi ( == \_root.abc.def.ghi)

or eval i.e.:  
eval("\_root."+“abc.def”).ghi

things you **can’t** do:  
[color=DarkRed] \_root.[“abc”].def.ghi[/color] (no dot before the brackets)  
[color=DarkRed] \_root[“abc.def”].ghi[/color] (there is only one mc inside the brackets (would probably work for a movieclip called “abc.def”))  
[color=DarkRed] \_root.eval("\_root.abc.def").ghi[/color] (eval always stands at the beginning of a path  
[color=DarkRed] eval[“abc”].def.ghi[/color] (eval only works with round brackets)

---

<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:** [July 24, 2004, 7:17pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/3 "2004-07-24T19:17:25Z")

</div>

**Sweet** 😃

Thanks for that **McGiver** … I will give it a go !

---

<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:** [July 24, 2004, 7:26pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/4 "2004-07-24T19:26:30Z")

</div>

No joy…

I thought I might have tried that, I have tried 20 or so variations, I have checked the names and linkages half a dozen times, tried relative and absolute paths and still can’t get it.

**[color=black]Here is another bit that was working.[/color]**

```php
for(i=0; i<10; i++){
eval("ring"+i).writename.text = "Loading...";
eval("ring"+i).writeage.text = "Loading...";
eval("ring"+i).writedate.text = "Loading...";		 
eval("ring"+i).writelocation.text = "Loading...";
box.eval("ring"+i).writecomments.text = "Loading Messages... Please wait...";
}

```

**[color=black]Here is what I just tried now that [color=blue]“ring”[/color] is inside [color=blue]“box”[/color] and box is inside [/color][color=blue]“scrol”.[/color]**

```php
 
for(i=0; i<10; i++){
_root.read.scrol.box["ring"+i].writename.text = "Loading...";
_root.read.scrol.box["ring"+i].writeage.text = "Loading...";
_root.read.scrol.box["ring"+i].writedate.text = "Loading...";		 
_root.read.scrol.box["ring"+i].writelocation.text = "Loading...";
_root.read.scrol.box["ring"+i].writecomments.text = "Loading Messages... Please wait...";
}

```

---

<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:** [July 24, 2004, 7:31pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/5 "2004-07-24T19:31:01Z")

</div>

following is wong:  
box.eval(“ring”+i).writecomments.text = “Loading Messages… Please wait…”;  
use  
box[“ring”+i].writecomments.text = “Loading Messages… Please wait…”;  
or  
eval(“box.ring”+i).writecomments.text = “Loading Messages… Please wait…”;  
instead

---

<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:** [July 24, 2004, 7:41pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/6 "2004-07-24T19:41:05Z")

</div>

> **use:**  
> box[“ring”+i].writecomments.text = “Loading Messages… Please wait…”;

This is what I just tried tried and it didn’t work.

[font=Courier New][color=#0000bb]\_root[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700].[/color][color=#0000bb]scrol[/color][color=#007700].[/color][color=#0000bb]box[/color][color=#007700][[/color][color=#dd0000]“ring”[/color][color=#007700]+[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]writecomments[/color][color=#007700].[/color][color=#0000bb]text [/color][color=#007700]= [/color][color=#dd0000]"Loading ";[/color][/font]  
[font=Courier New][color=#dd0000][/color][/font]  
[font=Courier New][color=#dd0000][/color][/font]  
[font=Courier New][color=#dd0000][/color][/font]

---

<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:** [July 24, 2004, 7:47pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/7 "2004-07-24T19:47:00Z")

</div>

so  
for the case  
i=5  
\_root.read.scrol.box[“ring”+i].writecomments.text  
would be read as  
\_root.read.scrol.box.ring5.writecomments.text

if  
\_root.read.scrol.box.ring5.writecomments  
is the path to a textfield that exists, it should work fine

---

<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:** [July 24, 2004, 7:54pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/8 "2004-07-24T19:54:19Z")

</div>

Thats what I thought…

I am thinking it has something to do with it being inside the scrollpane.

I tried using… ummm .content and ? contentPath but nothing I try works…

I have seached google top to bottom and here, and can’t find any reference to targeting inside the scrollpane…

I just don’t get it…

---

<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:** [July 24, 2004, 8:05pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/9 "2004-07-24T20:05:18Z")

</div>

you can access the content of a scrollbox with

name\_of\_the\_scroll\_pane.[color=Navy]content[/color]

so if you set the content scrollpane (we call scrolly) to a movieclip containing a textfield (we call hans) you can set its text by  
scrolly.[color=Navy]content[/color][color=Black].[/color]hans.[color=Navy]text[color=Black]=“whatever”[/color][/color]

---

<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:** [July 24, 2004, 8:19pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/10 "2004-07-24T20:19:31Z")

</div>

Well…  
I had my \*\*[color=blue]“ring” [/color]\*\*movie… (working fine)  
I put a scrollpane on the stage and named it **[color=blue]“scrol”.[/color]**

I delete the [color=blue]\*\*“ring” \*\*[/color][color=black]off the stage.[/color]

I create a new movie **[color=blue]“box”[/color]**  
I draged [color=blue] **“ring”** [/color] from the library into box.

I set component **[color=blue]“scrol”[/color]s contentPath to [color=blue]“box”**[/color] under options.  
giving me **[color=seagreen]scrol.box.ring[/color]**

I took the duplicate code off the frame where **[color=blue]“ring”[/color]** used to be and put it on the first frame of **[color=blue]“box”[/color]**.

```php
posx = (337.9+5);
for(i=1; i<10; i++){
duplicateMovieClip("ring", "ring"+i, i);
eval("ring"+i)._x =posx;
posx = posx + (337.9);
}

```

That duplicates 10 **[color=blue]“rings”[/color]** accross [color=blue] **“box”** [color=black]as it did before[/color] [/color]so that I can scroll through all ten in **[color=blue]“scrol”.[/color]**

So all I should have had to do is change the path of the code I had to reflect  
**[color=green]scrol.box.ring5.text =[/color]**

**[color=red]But nothing I try works…[/color]**

I just pasted this under the duplicate code above. It is now in the same place in relation to the code above as it was before.  
But it still won’t change the text !

```php
for(i=0; i<10; i++){
this["ring"+i].writename.text = "Loading...";
eval("ring"+i).writeage.text = "Loading...";
eval("ring"+i).writedate.text = "Loading..."; 
"ring"+i.writelocation.text = "Loading...";
eval("ring"+i).writecomments.text = "Loading Messages... Please wait...";
}

```

---

<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:** [July 24, 2004, 8:38pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/11 "2004-07-24T20:38:12Z")

</div>

Ok I just tried this and still nothing works… ☹

```php
for(i=0; i<10; i++){
this.content.box["ring"+i].writename.text = "Loading...";
scrol.content.box.eval("ring"+i).writeage.text = "Loading...";
scrol.content.box.eval("ring"+i).writedate.text = "Loading...";         
this.scrol.content.box.eval("ring"+i).writelocation.text = "Loading...";
this.scrol.content.box["ring"+i].writecomments.text = "Loading Messages... Please wait...";
}

```

**There must be something I am missing…**

---

<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:** [July 24, 2004, 9:21pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/12 "2004-07-24T21:21:19Z")

</div>

its  
scrol.content.ring5.text  
since “box” is set as content

---

<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:** [July 24, 2004, 9:35pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/13 "2004-07-24T21:35:54Z")

</div>

**[size=4]GOD DAM I HATE BEING A NOOB ![/size]**

**[size=4][/size]**  
[size=4]It’s always the most stupid little things that send me around in circles for hours…[/size]  
[size=4][/size]  
[size=4][/size]  
[size=4]I LUV you man ![/size]  
[size=4][/size]  
Not in that way, Not that there is anything wrong with that. 😃  
**[size=4][/size]**

---

<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:** [July 24, 2004, 10:14pm UTC](https://forum.kirupa.com/t/eval-path-problem/58647/14 "2004-07-24T22:14:09Z")

</div>

glad I could help  
(and yes, it **is** always the most stupid little thing, and you are not a noob)
