Hi there!\r\rI want to load Variables from a .txt-file to edit the properties of a movieClip. For example: 700 is written in the .txt-file. After loading the Clip the x-position of the clip should be set to 700. How can I do this?\r\rTHX

write a txt file called “variables.txt” :\r\rx=700\r\ron the movieclip in question:

 \r\ronClipEvent(load){\r\r   loadVariables("variables.txt",this);\r\r}\r\r\r\ronClipEvent(data){\r\r   _x = x;\r\r}

\r\rvariables.txt will have to be in the same directory as the swf. if you want to put it somewhere else, that’s fine, but you’ll have to reflect those changes in the load variables statement.\r

Can you explain how that onClipEvent (data) works ?\rpom 0]

it’s an event handler that fires when a movie has finished loading from a loadVariables call OR fires continuously during a loadMovie (useful for load meters).

Hi once again!\r\rI’ve tried to load variables with “onClipEvent (data)” but it didn’t work. The .swf doesn’t read the variables, because I made a testtextfiled that should write the value of the read variable but it was blank after loading the clip.\rAny idea?\r\rTHX

I tried it, and it works nice and smooth. What I did is the following :\rI put a DYNAMIC text box that I called “test”, no “”.\rI drew a small circle outside the scene, turned it into a movie clip, then copied and pasted Supra’s code in its Actions panel, changing it a little bit into

 onClipEvent (load) {\r\r    loadVariables ("variables.txt", this);\r\r}\r\ronClipEvent (data) {\r\r    _root.test = x;\r\r}

One important thing is that you have to put the text in the same folder as the swf\r\rpom 0]

Hi!\r\rTrying the thing with the textfield works fine, but applying the x-value to _x still doesn’t. When writing _x = 700 everything is alright, but writing _x = x has no effect. Why?

It works.

 onClipEvent (load) {\r\r&nbsp &nbsp &nbsp &nbsp loadVariables ("variables.txt", this);\r\r}\r\ronClipEvent (data) {\r\r&nbsp &nbsp &nbsp &nbsp _root.test = x;\r\r&nbsp &nbsp &nbsp &nbsp _x = x/3 ;\r\r}

Remember that all this is the code for a movie clip. If it dosn’t work, just gimme your email adress, I’ll send you the fla.\r\rpom 0]

Hi!\r\rI’m goin’ crazy!!! Please send me your .fla so that I can compare: [email protected]\r\rTHX a lot\r\rHartwig

sent.\rpom 0]

THX for your fla! It works, as U said. BUT I HAVE NO IDEA WHY MY FLA WHICH LOOKS QUIET THE SAME DOESN’T WORK! Thanks anyway!

[email protected]\rI’ll take a look at it.\rpom 0]

Here is what I have so far, and I think I’m running into similar issues, although slightly different than the topic.\r\rI have a text file called quotes.txt\r\rIn it I have several quotes like so:\r\rquote1=whateveritis&quote2=thisiswhatitis&quote3=nevermindwhatitis\r\rI have one text box in flash and the following script:\r\rvar test = random (3) + 1;\rvar ques = ‘quote’ + test;\rloadVariablesNum (“quotes.txt”, 0);\r_root.quotedisplayvar = ques;\r\r\rNow what I’m trying to get it to do is pick 1 of the 3 quotes from the text file. There are three there, need it to randomly pick 1 and display it in the text box in flash. The problem is, based on the above script, what it is doing is displaying \r\rquote1 - quote 2 - quote 3 instead of the actual quote from the file.\r\rAny thoughts?\r\rChris

Yes, you have to evaluate the result. The easiest way would be to put _root.whereeveryouare[“quote”+test] ;\rNotice that there is no “.” before the []. I’ll try to make it work. Just be careful with the path you’re using. I know Suprabeener would kill me for that, but putting it in _root would be easier.\r\rpom 0]

As ilyas said, you are putting the resulting name of quote in there, not it’s content, which you’ll extract using eval.