Start a new topic

Update distance label

Update distance label

Hi!

I am a newbie in Wikitude and I have a question. How can I update a label with distance on a point, when location changes? I know how to use onLocationChanged and distanceTo function and I made it work with the use of destroyAll() and then redraw point whenever location changes, but thi solution cannot be the right one. Although it works it is not OK because the point blinks when destroyAll() + redraw happens...  Is there any simple way to refresh the label? 
Hi,

to change a label's text you don't have to destroy it. You can use the AR.label's text property to change the displayed text anytime (e.g. whenever a location update is received). Let me know if this is what you were looking for.
Hi!

Thanks for the tip, but I just can't get this to work. I have multiple points with a label. I use FOR clause to create them. Then I use AR.context.onLocationChanged = function (....) { } to update it, but I just don't know how to use AR.label's text property, to be updated... 
Got it to work. Thanks for the tip :)
Login or Signup to post a comment