PDA

View Full Version : loadvariables function



Monabizi
January 14th, 2004, 08:20 AM
hi,
i want to load variable from text file to my main movie (swf file).
what should i put in the second parameter of the function loadVariables ("target" parameter) - should i insert _this? _parent? _global? (nothing works...)


Help!!:confused:

monAmour
January 14th, 2004, 08:24 AM
_level0._root

Monabizi
January 14th, 2004, 08:27 AM
it doesn't works :( look:

ScriptFlipper
January 14th, 2004, 12:26 PM
I sorted you mess out for you...
Here you go:


recievedVars = new LoadVars();
loadIt = function () {
recievedVars.load("vars.txt", _root.recievedVars);
recievedVars.onLoad = function (success) {
if (success) {
trace("OK. Your variables is now in recievedVars. For example if you have a variable that is called test, it will be in recievedVars.test");
trace(_root.recievedVars.test);
} else {
trace("Error. Wrong filename etc.");
}
}

}

// You can also put this line in the onClipEvent(load){} function (or the (enterFrame) ) for the movieclip on the stage.
loadIt(); //calls the function to load your variables
/////////////////////


posted a zip-file with .fla and .txt