i'm showing/hiding mapview routes but when i implement this the first click removes the route but text stays at "off" - subsequent clicks toggle the route and text but the text is now 1 step behind ???
(i tried this with an imageview & the same thing happens)
var routeSwitch = Titanium.UI.createSwitch({ top:40, left:0, value:false, visible:false }); container.add(routeSwitch); var routeCheckbox = Titanium.UI.createLabel({ text:'off', width:50, height:50, top:40, left:10, color:'#fff' }); routeCheckbox.addEventListener('click',function(e) { if(routeSwitch.value==false) { routeSwitch.value = true; routeCheckbox.text = 'off'; mapview.removeRoute(route); } else { routeSwitch.value = false; routeCheckbox.text = 'on'; mapview.addRoute(route); } }); container.add(routeCheckbox);
Your Answer
Think you can help? Login to answer this question!