Groups | Blog | Home
all groups > flash actionscript > march 2004 >

flash actionscript : Accessing Variables outside an onLoad function???


james_robson_25
3/18/2004 11:56:25 PM
Hi Out there

i have the following code as an example

something = new LoadVars();
returnedSomething = new LoadVars();
something.variable1_1 = "hello World";
something.sendAndLoad("process_script.php", returnedSomething, "POST");
returnedSomething.onLoad = function() {
variableReturned = this.rString;

}

Now my question is how can i access the variableReturned variable from
outside of the onLoad function. Ie: a bit later in the code i will need
it......how can i get it??? I have tried many solutions by having a stand
alone function and calling that with returnedSomething.onLoad =
standAloneFunction;

Thanks in advance

Any ideas.

verafleischer
3/19/2004 1:36:26 AM
The variableReturned variable will be accessible from outside the function the
way you declared it. Only if you had put a "var" in front of it, would it be
only accessible from within the onLoad function.

// first frame
something = new LoadVars();
returnedSomething = new LoadVars();
something.variable1_1 = "hello World";
something.sendAndLoad("process_script.php", returnedSomething, "POST");
returnedSomething.onLoad = function() {
variableReturned = this.rString;
anotherFunction();

}
anotherFunction = function() {
trace(variableReturned);
}
AddThis Social Bookmark Button