Post 6 made on Wednesday October 14, 2015 at 22:48 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 12,999 |
|
|
If you put a loop in the code, that is not a good idea as your UI may never refresh except for the picutre at hand.
Either put script into Page Script and set the Page Interval to every 2 or so seconds. Also, a better approach is to have look at the DEV Guide around CF.activity().scheduleAfter();
Here's the way to do this.
At the end of the code you currently have in the page script, put in the following assuming that you have a single page.
var intervalMs = 2000; var panel = GUI.widget('MYPANEL'); // Display the first time. showHTTPImageEx('192.168.0.10', 'http' + '://' + '192.168.0.10:8080/myImage.jpg', panel, 0);
// Repeat/reload every 2 seconds. CF.activity().scheduleAfter(intervalMs, function(p) {
showHTTPImageEx('192.168.0.10', 'http' + '://' + '192.168.0.10:8080/myImage.jpg', panel, 0); if (CF.page() == p) { // still on same page, request update again in 2 seconds. If page has // changed, then reschedule will not occur effectively cancelling until // you return to the page. CF.activity.scheduleAfter(intervalMs, arguments.callee, p); } }, CF.page());
|
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|