Question

I wrote code (in Macromedia Flash 8) that needs to write and read data in a data.txt file located in a remote server. First it must be written new state of variables using this

    updater.sendAndLoad("http://remtoteserver.com/updater.php", updater, "POST");

the php file will write new data in json format in a data.txt. Then, it is needed to read that new data and show in the screen.

    reader.load('http://remtoteserver.com/data.txt');

and in a later frame, reader is defined by

    var reader:LoadVars = new LoadVars();
    reader.onLoad = function(success) {

    if (success) {
       trace("load successful");
       var oo:Object = JSON.parse(unescape(this.toString()));
       ncol = oo.ctot;
       numTry = Number(oo[someData].ntry);
       col[1] = Number(oo[someData].sc25)/100;
       col[2] = Number(oo[someData].sc26)/100;
       etc...
    } else {
          trace("unable to load data");
           }
    };

Well, everything is fine when I test this in flashplayer in my PC, BUT when publish the html in the same server and then test it, (1) if I update data, I realize that new data is writen in data.txt but fails to read after that, it just read the data before they were updated (old data). And if I try to update the data several times, neither updater and reader seem to work. I have to close the web page and load it again, and we are in the point (1). In brief, it seems that I have only one access to the data.txt per session (for writing or reading it), I don't know if it is a security matter from the people who manage the (free) server or what. But as I said, if I test the flash file in my PC, it's alright. Another comment, some flash methods seem not to work in Chrome, like beginFill(). Any comment or help will be appreciated.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top