Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LoadVars and jumping to another frame

Status
Not open for further replies.

clemrock

Programmer
May 20, 2004
118
US
Hello,

I have always been frustrated by the LoadVars method in Flash. I am simply trying to hit a submit button which calls a function w/ the LoadVars method to read the contents of 10 text files. If the proper contents in the text files are found, then the program will proceed to the next frame.

If I could set a return variable in a function such as this:
_global.file_found;

function file_exist( file_name )
{
fileExists = new LoadVars();
fileExists._parent = this;

fileExists.onLoad = function(success)
{
if(success)
{
trace( "FILE EXISTS!!!" );
file_found = true;
}
else
{
file_found = false;
trace( "FILE DOESN'T EXIST**" );
}
}

fileExists.load( 'patient_sessions/' + file_name + '.txt' ) //initiate the test

return file_found;

}//__endFunc__


It would probably solve all my problems. I can't seem to make a global variable to read out side the
 
not quite sure what you are trying to do but if only want to check if a file exists then a server side script is the way to go

with php its as simple as

<?print("fileExists=".(@is_file($filePath) ? 1 : 0)."&");?>

this will return 1 (exists) or 0 (not found)

if however you just want to read 10 separate files and search for a word/phrase then load only files with a hit this is again easier done server side but possible directly from flash

what i would do is use a server side script to return a list of all text files in a folder then have loadvars load them one at a time. check for whatever you need and if found add the file name to an array. then display whatever it is want from those text files present in the final array
 
clemrock,

I am having identical problem with Flash. After loadVars method loads variables from a text file, an array is created from the loaded data. But the array will not persist as a global variable. All other frame scripts see the array as "undefined."

If you find solution, please post. Will do likewise.

Thanks,
Tom
tbonez05
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top