PDA

View Full Version : [MX2004] Function Variables



kBisk
March 8th, 2005, 05:43 PM
I need the img_n variable below to be equal to a text value when hover_n equals different intergers.

img_n = ("i"+hover_n+"_caption");

For example, if hover_n=23, then img_n = i23_caption;

Is there a text equivalent to eval() or something that can return this value?

Templarian
March 8th, 2005, 06:34 PM
function = img_n(hover_n){
return ("i"+hover_n+"_caption");
}
like that? I'm not sure if you have to write something special with the function when u return something. is that what u were thinking, when u evaluate img_n(16)="i16_caption"
**note img_n returns a string

kBisk
March 8th, 2005, 06:37 PM
Yes that's exactly what I need it to do... however, I can't test that right now, but I'll let you know if it works.

Thanks

Templarian
March 8th, 2005, 06:37 PM
then u could say _root[img_n(10)]. something to in fact look at
_root.i10_caption. something

Templarian
March 8th, 2005, 06:37 PM
your welcome