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!
[AS]function loadStuff(){
//do what you want here
}
myInterval = setInterval(loadStuff, 1000);[/AS]
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)
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?
the // is a comment, you put your code to load the stuff there
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);
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
What do u mean by ‘displays the text as well’?
in the dynamic textbox
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.
yes, it does