With which code do I have to replace in order to update the label?
bye
Christian
W
Wolfgang Damm
said
almost 11 years ago
hi if you want to add the label to the currToken.poiObj AR.GeoObject have a look in the API spec under AR.ARObject (base class of GeoObject)
Either use:
currToken.poiObj.drawables.cam = new Array(label); to replace all drawables, or:
currToken.poiObj.drawables.addCamDrawable(label) to add the label.
C
Christian
said
almost 11 years ago
Hi Wolfgang,
thanks for the swift reply. This actually solved the problem. However, there is a strange behaviour and I'm nur sure if this is a Wikitude SDK bug or a bug in my app.
Currently, I trigger an update-label script every second (this is only for debugging - in the final version this script will probably be called every 20 - 30 seconds). This is the code I use to update the label:
var label = new AR.Label(currInfo.distance, 0.8*currInfo.scale, {offsetY : +0.7*currInfo.scale, offsetX: +1.3*currInfo.scale, triggers: { onClick: createClickTrigger(currInfo.id)}, style : {textColor : '#FFFFFF'}}); var img = poiImages;
currToken.poiObj.drawables.cam = new Array(label, img);
Everything works fine for the first 60 - 90 calls. Then suddenly the label is not going to be displayed (the image itselft is still being drawn, only the label disappears).
Echoing label.text still produces correct results, i.e. the AR.label seems to be okay. Any suggestions?
Thanks
Christian
W
Wolfgang Damm
said
almost 11 years ago
You are running into resource problems as you are creating new labels each time the script runs. However there is an easy fix:
- call .destroy() on the old label that is no longer needed.
Christian