|
|
|
#1 |
|
Member
Join Date: Mar 2003
Location: Netherland
Posts: 33
|
interval to update
Hello,
i have a question, i try a lot but how can i simple update from a url? I use a simple perl file that sends data (text) separated ' ; ' for every new line (for the test it shows local time and ip) I try the code below local, and it updates it self nice, so every 5 sec i saw new updated text. But when i use the url from the hosted server it only loads ones, then only it repeat his own text in message.text. Is there a way to to get this right ? Thank you, Hans / *** create output field *** myTextFormat = new TextFormat(); myTextFormat.font = "Verdana, Helvetica"; myTextFormat.size = 12; myTextFormat.color = 0x000000; createTextField("message",1,23,49,564,258); message.border = false; message.background = false; message.multiline = true; message.wordwrap = true; message.scrolbar = true; message.setNewTextFormat(myTextFormat); lv = new LoadVars(); update= function (){ lv.load('http://www.screensave.nl/get.pl'); } lv.onData = function(src){ records = src.split(';'); for (var b = 0; b < records.length; b++){ message.text=message.text+records[b]+'\n'; } } setInterval(update, 5000); update();
__________________
|
|
|
|
|
|
#2 |
|
Steve R
Join Date: Jan 2005
Location: Leicestershire,UK
Posts: 195
|
its not necessarily the problem, but sometimes things get cached.
When I read dynamic data I always put "?random="+math.random() at the end of the url. This makes the browser think you are asking for a response and makes it make a new request each time Steve |
|
|
|
|
|
#3 |
|
Member
Join Date: Mar 2003
Location: Netherland
Posts: 33
|
re:
Hello swrzzzz,
thanks for your answer. I did try to put the code at the end of the url, you wrote but still not working well, so i try this code now, and now it update great. i don't know if this is a good one to use to update data but i think it is. Thank you, Hans update= function (){ _root.loadVariables("http://www.screensave.nl/get.pl", "POST"); records = i.split(';'); for (var b = 0; b < records.length; b++){ message.text=message.text+records[b]+'\n'; } i = ""; _level0.message.scroll += 15;_level0.dwn = 1; } setInterval( update, 3000, ); update();
__________________
|
|
|
|
|
|
#4 |
|
Steve R
Join Date: Jan 2005
Location: Leicestershire,UK
Posts: 195
|
OK
It's cool that you got it working and it was obviously a caching issue. I just noticed a typo in my reply -it should have been Math.random (capitalised) and it wouldn't have worked if you just copied in the text:-( Sorry Steve |
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|