View Full Version : Refresh File Manually.
REEFˇ
November 15th, 2003, 12:38 PM
I have this PHP code that writes to a text file, then Flash prints out the vars. How would I make the file refresh manually every second? This'll help a looot!
lostinbeta
November 15th, 2003, 12:41 PM
function loadStuff(){
//do what you want here
}
myInterval = setInterval(loadStuff, 1000);
loadStuff is the function that will contain the code to los your information
myInterval is a setInterval that will run the loadStuff function every 1000 milliseconds (1 second)
REEFˇ
November 15th, 2003, 01:03 PM
Uhh, this is kinda confusing. I mean, Yeldarb told me to use setInterval, ok. Now, load stuff is a function...got it. But, What do you mean, do what you want here? How would flash know where to load the vars from? What about bandwidth? Will this effect BW?
Yeldarb
November 15th, 2003, 01:08 PM
the // is a comment, you put your code to load the stuff there
REEFˇ
November 15th, 2003, 01:11 PM
Ah ok. So would this work:
function loadVars() {
loadVariablesNum("file.php", 0);
}
// Run this function every 2 secs. 1000 = 1 second.
myInterval = setInterval(loadVars, 2000);
Yeldarb
November 15th, 2003, 01:13 PM
i'm not familiar with loadVariablesNum, but if that was the only code you were using to refresh it, then yes, but you may want to have it update where it displays the text as well
REEFˇ
November 15th, 2003, 01:44 PM
What do u mean by 'displays the text as well'?
Yeldarb
November 15th, 2003, 01:56 PM
in the dynamic textbox
REEFˇ
November 15th, 2003, 02:05 PM
That's what I'm doing. This thing is for shoutbox kind of thing. Since my code is:
function loadVars() {
loadVariablesNum("file.php", 0);
}
// Run this function every 2 secs. 1000 = 1 second.
myInterval = setInterval(loadVars, 2000); - Does this mean that it'll load the variables from file.php every 2 seconds?
- BTW, My bad, I meant refresh automatically.
Yeldarb
November 15th, 2003, 04:21 PM
yes, it does
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.