Start a new topic

Continous updating of Label

Continous updating of Label


Hi,

thanks. I tried with setInterval, semms to work now.


Hi Marcus,

 

 

The setTimeout function only executes the given callback once. If you wish to update your label continuously you may use the setInterval function. It takes a callback function and a time interval in milliseconds as its input parameters.

 

Here is a trivial ARchitect world showcasing its usage:

 

var World = {

 

    init: function initFn() {

        var func = function foo() { console.log("foo called."); }

        setInterval(func, 100);

    }

};

 

World.init();

 

 

Output:

 

foo called.

foo called.

foo called.

foo called.

foo called.

...

 

 

I believe this behaviour is what you tried to reproduce with the code you provided.

 

 

Kind Regards

Daniel

 

Hi,

 

I have a simple Scene with a label showing over the recognized image.

Now I want to change the label text continously with something liek streaming data.

I tried from my cordova environment.:

function onARExperienceLoadedSuccessful(loadedURL) {

function getData() {

var inp = String(sap.ui.getCore().byId("idView1--__input0").getValue());

wikitudePlugin.callJavaScript('testFn('' + inp + '\')');

}

var b = 5;

while (b > 1) {

setTimeout(getData(), 5000);

}

 

}

Unfortunately this only works once, the inp value is correctly displayed in the label.

Howeverit seems the process in the cordova is then stopped.

How can I mke the feed continous ?

Any help is appreciated.
Login or Signup to post a comment