Passing variables between movies

I have two movies: m1 and m2. In m1 I set a variable to variable=“yes”. Now, I want m2 to read the variable and do an action depended on the variable (see the example below).\rHow do I do this?\r\rThis is the AS in m1:\r\ron (release) {\r&nbsp &nbsp &nbsp &nbsp docufield = “background.txt”;\r}\r\rAnd this is the AS in m2:\r\rthis.loadVariables(docufield);\r\rAchnor

2 movie clips or 2 swf ?? Cos you can’t load variables from a swf (nor from a movie clip by the way…).\r\rpom 0]

two swf…it can’t be done?\r\rHere’s the full story:\rI have a menu.swf and a document.swf, both loaded into a holder.swf. When I click on the menu I want to pass a variable telling document.swf wich .txt to read from and display on-screen.\r\rAchnor

you just have to target the variable properly.\rwhether you loaded into a target or a level you have to path to that clip.\rexample:\rif you loaded the 2 swf’s into levels 1 and 2 respectively the paths would be something like this…\r_level1.myVariable\r_level2.myVariable\rif you loaded into targets named mc1 and mc2 the paths would look like this…\r_level0.mc1.myVariable\r_level0.mc1.myVariable\ror…\r_root.mc1.myVariable\r_root.mc2.myVariable\r\rwhen swf’s are loaded into other swf’s they are basically movie clips and can be targeted as such.\r:) \rjeremy

Thanks. I guess this will work, however, I’ve encountered another problem. As described above, I set a varibale (docufield) to “data.txt”, but, when I do this:\r\ronClipEvent (load){\r&nbsp &nbsp &nbsp &nbsp this.loadVariables(docufield);\r}\r\rit wont load data.txt. Can’t I use variables this way?\r\rAchnor

it should work. i did a test and it was fine.\rtest your movie and then go to ‘debug’ and ‘list variables’. you should see the variables that were loaded in the output window.\r:) \rjeremy

Yup. It worked. The reason it didn’t work in the beginning was because I used this enormous tutorial on how to make scrollable text and I didn’t understand half of it and when I implemented the code It didn’t behave they way I wanted it to, soo, 3 hours later and with much less AS (selfproduced this time) I made it and now it works. Thanks for the help.\r\rAchnor

less code means that less can go wrong.\rglad it works!\r:) \rjeremy