Eval () / path problem

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

if (this["writename"+i] == undefined) {
eval("ring"+i)._visible = false; 
eval("ring"+i).writename.text = "";
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.

if (this["writename"+i] == undefined) {
scrol.box.eval("ring"+i)._visible = false; 
eval("ring"+i).writename.text = "";
scrol.box.eval["ring"+i]._visible = true; 
scrol.box.eval["ring"+i].writename.text = this["writename"+i]; }}

Any ideas ?

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

or eval i.e.:

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)

Sweet :smiley:

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

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]

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]

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...";

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

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]

for the case
would be read as

is the path to a textfield that exists, it should work fine

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…

you can access the content of a scrollbox with


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

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].

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 !

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...";

Ok I just tried this and still nothing works… :frowning:

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…

since “box” is set as content

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

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

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