0

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.

JoeCoolman
  • 512
  • 3
  • 8
  • 27
  • place between write and read a loop to give logic more time. The flashplayer is much faster than running on a server. – moskito-x May 27 '13 at 02:36
  • "I have to close the web page and load it again" looks like a cache issue to me. – Aralicia May 27 '13 at 09:01
  • I've read carefully Macromedia Flash 8 documentation and fixed some mistakes like my **updater** call function, in my version, the response from server must be handled by another function of type LoadVars. Other thing, I call reader.onLoad by assuring first all data were downloaded by using reader.onData (built in func), after that onLoad is called. The movie doesn't progress if the data are not full sent or downloaded and again, in my flash player everything goes right but when tested from the html it doesn't work correctly. – JoeCoolman Jun 04 '13 at 15:12
  • It's a application to do a multiple-choice exercises from http://joe.freevar.com/mch_fixed2.html, try it in several browser if you please. The password is *invitado* . – JoeCoolman Jun 04 '13 at 15:13

0 Answers0