PDA

View Full Version : Anyone need to read ANY txt-files into flash?


duhuskermeg
08-20-2001, 10:45 AM
Hi all,

With this script, you can read any file into flash with each line as variable. Call it from flash like this:
Loadvariables(ReadURL.php?http://www.server.com/myfile.wtf)

Now, each line in the textfile is loaded into flash, and you can do whatever you want with the file. Extract values etc.

ReadURL.php
<?
$fp = fopen ($URL, "r");
$counter = 1;
$buffer = fgets($fp, 4096);
$line = '&line';
echo "$linje$counter=$buffer";
while (!feof ($fp)) {
$counter = $counter + 1;
$buffer = fgets($fp, 4096);
echo "$line$counter=$buffer";
}
echo "&xlines=$counter";
fclose ($fp);
?>

In flash, you can add a variable called URL and assign the URL to your file. Then, use this script to read the lines from the script and assign them to variables.

if (URL ne "") {
loadVariablesNum ("http://stavanger.aof.no/ReadURL.php?URL=" add URL, 0);
nr = 1;
while (nr < xlines) {
set (line + nr, line + nr);
}
xlines = xlines;
} else {
gotoAndStop (whatever);
}



TranceMore

Jesse
08-20-2001, 11:04 AM
cool, we also appreciate it if useful scripts are added to the Library, see the link above.