Hello,
I have an ongoing problem w/ the LoadVars() function and the scope of variables. I would loke to have a situation where I can read the values of a file, set those read values to global variables and use them throughout the program. Now know I can set a text box to recieve the read values but It seems like a copout
Here’s the code I’m using:
_global.db_script_data = new LoadVars();
db_script_data.onLoad = function(success)
{
if( success == true )
{
_global.user_level = db_script_data.user_level;
_global.user_id = db_script_data.user_id;
}
else
{
txt_output += "
!!!No read vars failed!";
}
trace( "user_id: " + user_id ); //will show user_id as “1”
}
db_script_data.sendAndLoad( “verify.php”, db_script_data, “POST”);
trace( "user_id: " + user_id ); //will show user_id as undefined
I know there’s probably an easy solution staring me in the face.
Thanks,
Clem