Loading variables from a txt file

Hi,

I’m trying to load some variables dynamically from a text file,
when a button is pressed. They will not load on first press , but on second
or subsequent presses they will.

Anyone any ideas ???

Noodles…

numCatalog=0;

portf4.onRelease = function() {
loadVariables(“images/cg.txt”,"");
trace(numCatalog);
};

You’re tracing the variable too soon. The data has not arrived yet. One solution would be to have a variable at the end of your file and check if that variable has arrived yet. Then you can trace what you want.

If you’re running the code locally, you have to wait at least one frame before you can trace loaded data.

pom :cool: