Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 29th, 2012  |  syntax: None  |  size: 1.14 KB  |  views: 77  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. var mapview = Titanium.Map.createView({
  2.     mapType: Titanium.Map.STANDARD_TYPE,
  3.     region:{latitude:-33.8642194, longitude:151.2095497},
  4.     animate:true,
  5.     regionFit:true,
  6.     annotations:[]
  7. });
  8.  
  9.  
  10. var getShops = Ti.Network.createHTTPClient();
  11.  
  12. getShops.open('GET', 'URL');
  13.  
  14. getShops.onload = function(){
  15.  
  16.          var xml = this.responseXML;
  17.          
  18.          var resultList = xml.documentElement.getElementsByTagName("Result");
  19.        
  20.         for (i = 0; i < resultList.length; i++)
  21.         {
  22.                
  23.                 var resultName = resultList.item(i).getAttribute("name");
  24.                 var resultLat = resultList.item(i).getAttribute("lat");
  25.                 var resultLng = resultList.item(i).getAttribute("lng");
  26.                 var postId = resultList.item(i).getAttribute("postId");
  27.                
  28.                 var mapit = Ti.Map.createAnnotation({
  29.                         latitude: resultLat,
  30.                         longitude: resultLng,
  31.                         myid: postId,
  32.                         animate: true,
  33.                         title: resultName,
  34.                         pincolor: Ti.Map.ANNOTATION_RED
  35.                 });
  36.                
  37.                         Titanium.API.info(resultLng);
  38.                
  39.                 mapview.addAnnotation(mapit);
  40.         }
  41.  
  42.         };     
  43.  
  44.  
  45. getShops.send();
  46.  
  47. var map3 = Ti.Map.createAnnotation({
  48.         latitude: -33.8642194,
  49.         longitude: 151.2095497,
  50.         pincolor: Ti.Map.ANNOTATION_RED
  51. });
  52.  
  53. mapwin.add(mapview);
  54.  
  55. mapview.addAnnotation(map3);
clone this paste RAW Paste Data