PDA

View Full Version : loadVariables('test.txt');


Adept Developer
05-16-2002, 07:56 PM
When using the syntax:
loadVariables('text.txt');

This works locally while I'm developing the SWF in the Flash Editor, but when I add the SWF to an HTML file on my server and the test.txt file along with it, it doesn't work.

How does Flash look at the file system? I have tried using absolute and relative paths and nothing seems to work.

-Steve

Rupert
05-16-2002, 11:21 PM
I don't know if it vital but maybe give it a level to load into:
loadVariablesNum ("text.txt",0);

Rasta Gonzales
05-17-2002, 07:33 AM
...hi there,

I used to do this textloading stuff this way once:

loadVariables ("textfilename.txt", this);

and it worked.

"this" hereby loads all the variables into the same movie as where this script is located, here it was a MC containing only code, I called it my "textloader".
I added a loop checking for a variable's status which would be set at the end of the textfile...e.g.:

blabla...&loaded=true

loaded id defined "false" at the startframe of the textloader.

the last frame of the loop is a check of the loaded-state.

if (loaded !="true") {...

...loops back to the loadvariables-frame,

else {...

transfers all the loaded variables within this movieclip to the places where they belong, e.g.:

_root.anothermovieclip.anothervar = variable;

after that the whole thing stops.

The problem here is that especially via a weblink transfertimes of data are definitely longer than on your harddisk, so you really need a loop and a check of the loading status since flash runs to the next frame before anything is loaded.

This is a general problem I have with flash:

if I script something with variables to be loaded and add some code after this loading command flash seems to do ALL the code and then does what it's told, and not executes every command one after the other, so it would wait until everything is loaded before it executes the next line of script.

Any comments about this?

been of any help? If things aren't clear yet I think I could upload a simple file...

:p