I load variables from a text file named :\r\r&first1=John\r&first2=Mark\r&first3=Tim\r&first4=Mike\r\rI am evaluating them in a loop by constructing the variable I want to test and assigning it the value of first1, first2, etc. based on the current loop iteration\r\rFor Example, during iteration start_num=1 :\r\r test_first = “first”;\r test_first = test_first.concat(start_num);\r run_first = eval (test_first);\r\rThis makes the variable I want to test, run_test, and assigns it the value of, first1, which is John. So :\r\r run_test=John\r\rHowever, I am comparing, run_test, to a input from a text box, text_input. text_input is type string, but run_test is type undefined.\r\rHow do I convert the variable run_test to a string so I can evaluate it in an IF statement?
in the script you’ve posted, there’s no point where you assign anything to run_test, which would explain why it’s undefined. ; )\r\ryou have assigned run_first, is that meant to be the assignation?\r\rpotential typos aside, variables from txt files are strings by default there’s nothing you’re doing to change the data type so all your data here is a string.\r\rif you want to be absolutely sure, to convert data to a string is:\r\rString(data);\r
although you don’t have to initiate variables in flash, i find that it is still a good idea.\ri pick a frame near the beginning of the timeline and declare EVERY variable that is used throughout movie and put a description of what the variable is/does.\rexample:\r// string for input text box\rsMyString="";\r// that’s it.\r\rnow if you do this:\rtrace typeof(sMyString);\r\rit will return “string” in the output window. if you do the same trace without initializing the output window will be empty.\r:) \rjeremy