Loading external variables, problem with string to num

ok… I really feel like pounding my head against a wall here.\r\rI’m importing variables from a regular txt file. I have dynamic text fields on the main timeline that pick up and show these variables. I know that they are coming into the player at _root, or _level0\r\rrows=“5”; is one of them. When I do a debug/List variables, that’s what it shows me.\r\rI do a \rtrace(rows);\rand I get\r"undefined"\r\rI do a\rparseInt(rows);\rand I get \r"NaN"\r\rWhat is it exactly that I can’t get?\r\rA) Why can’t I trace the @#%$ variable?\rsince you should be able to trace anything, and\rB) Why can’t I convert it to a number from the string of “5”?\r\rany clue?? I’m on 5 days of insomnia, and I just can’t figure out what I’m doing wrong…

let’s see your text file. most of the time the problem is there.\ralso, do you have a flag at the end of the text file to let the timeline know that all the text has loaded?\r:) \rjeremy

&date0=2002-04-06%2009%3A17%3A08&name0=administrator&email0=dhaisley%40centerspin.com&site0=www.centerspin.com&comment0=Well%20no%20matter%20who%20created%20it%2C%20I%27m%20in%20charge…&date1=2002-04-06%2009%3A16%3A11&name1=Upuaut&email1=administrator%40centerspin.com&site1=www.centerspin.com&comment1=Hey%2C%20get%20the%20hell%20out…%20this%20is%20MY%20creation&date2=2002-04-06%2009%3A12%3A19&name2=David&email2=Upuaut%40centerspin.com&site2=www.centerspin.com&comment2=Well%2C%20here%27s%20the%20guestbook…%20or%20at%20least%20a%20Beta%20version.%20Please%20sign%20it%20and%20let%20me%20know%20what%20you%20think.&rows=3&flag=true

ok, i got the file to load the variables. here’s what i did.\rframe 1:\rloadVariables (“loadme.txt”, this);\rframe 3:\rif(flag==“true”){\rtrace(“playing through”);\rplay();\r} else {\rtrace(“looping”);\rgotoAndPlay(_currentframe-1);\r}\rframe 4:\rfor(ii in this){\rif(typeof(ii)==“string”){\rtrace (ii+": "+this[ii]);\r}\r}\rstop();\r\r…\rnow, to convert a string that is a number to a number, i do this:\rrows*=1;\r\rand i did change the text file for clarity…\rdate0=2002-04-06%2009%3A17%3A08&\r&name0=administrator&\r&email0=dhaisley%40centerspin.com&\r&site0=www.centerspin.com&\r&comment0=Well%20no%20matter%20who%20created%20it%2C%20I%27m%20in%20charge…&\r&date1=2002-04-06%2009%3A16%3A11&\r&name1=Upuaut&\r&email1=administrator%40centerspin.com&\r&site1=www.centerspin.com&\r&comment1=Hey%2C%20get%20the%20hell%20out…%20this%20is%20MY%20creation&\r&date2=2002-04-06%2009%3A12%3A19&\r&name2=David&\r&email2=Upuaut%40centerspin.com&\r&site2=www.centerspin.com&\r&comment2=Well%2C%20here%27s%20the%20guestbook…%20or%20at%20least%20a%20Beta%20version.%20Please%20sign%20it%20and%20let%20me%20know%20what%20you%20think.&\r&rows=3&\r&flag=true\r\ryou can put line breaks in your txt file if you put an amphersand at the end of the line.\r\rhope that helps.\r:)\rjeremy

yup… the only reason I format it like that is it is the way my php returns it.\r\rI’m unclear on something though.\r\rThe trace function I really could care less if I get to work… I hardly ever use it, which is why I don’t really have a good understanding of it yet. (I use text fields which display various info and then I just delete that layer when I have everything working.:slight_smile: )\r\rThe important part of this though is the conversion.\r\rwhy would rows*=1 return a numerical value if it’s a string?\r

Well… it works… that’s all I really care about… I’d still like to know why it does.\r\rThanks for the help. Much appreciation

OMG!!!\r\rok, never mind… you want to know what I was doing wrong? It had nothing to do with the variables at all. The problem was in my loop\r\rif (hub.flag==“true”){\r&nbsp &nbsp &nbsp &nbsp gotoAndPlay(4);&nbsp &nbsp &nbsp &nbsp \r}\r\rwas set to\r\rif (hub.flag=true){\r&nbsp &nbsp &nbsp &nbsp gotoAndPlay(4);&nbsp &nbsp &nbsp &nbsp \r}\r\r:) \r\rI’m an idiot\r\rThe reason this screwed up the trace was, I was tracing code that couldn’t exicute because the variables hadn’t loaded yet… as a flag=true statement will simply send that playhead onto frame 4 without even pausing.\r\rOr at least that’s what I believe was the problem as it is the only thing that I changed and now parseInt(); works like it’s supposed to.\r\rJesus I can be dumb when I’m tired.

dont feel bad upu, i’m dumb all the time.

Don’t say that, Jubby. You’re just… different, that’s all.\r\rpom :lol:

anyways…\rtrace just displays what you tell it to in the output window.\rexample:\rtrace(“hello”);\rif you put that in a movie and tested it the output window would show ‘hello’.\ri use trace a lot, and often create a function to trace sets of variables when they change.\r:) \rjeremy

how would you do that because yesterday i was trying to follow my variables while doing that Text animation and i couldn’t do it…

I would suspect that you either “loop” your trace function, or place it in a bunch of places throughout your code.\r\rMy problem with trace, I think, was two fold.\r\rA) I was not getting all the variables by the time the trace was called, and\rB) I was trying to trace the parseInt(); function which could not read the number anyway.\r\rIt was something like this\r\rtopStack=parseInt(rows)-1;\r\rDoes anyone know if that looks wrong? I was thinking that maybe it should be\r\rtopStack=(parseInt(rows))-1;\r\rwould it make any difference which way I did that?