Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected var markersInfo:Dictionary = new Dictionary();
- protected function getBusiness_resultHandler(event:ResultEvent):void
- {
- var xml:XML = new XML(event.result as String);
- businessList = xml.business;
- for (var i:int=0; i<businessList.length(); i++)
- {
- var bm:Bitmap;
- switch(businessList[i].type)
- {
- case "Hotel": bm = new Hotel as Bitmap; break;
- case "Hostel": bm = new Hostel as Bitmap; break;
- case "Pharmacy": bm = new Pharmacy as Bitmap; break;
- case "Restaurant": bm = new Restaurant as Bitmap; break;
- case "Supplies": bm = new Supplies as Bitmap; break;
- case "Work": bm = new Work as Bitmap; break;
- case "Bike": bm = new Bike as Bitmap; break;
- }
- var latLng = new LatLng(businessList[i].latitude, businessList[i].longitude);
- var options = new MarkerOptions({icon:bm, iconOffset: new Point (-23, -44)}));
- var businessMarker:Marker = new Marker(latLng, options);
- businessMarker.addEventListener(MapMouseEvent.CLICK, onMarkerClick):void
- markersInfo[businessMarker] = businessList[i];
- Map.addOverlay(businessMarker);
- }
- }
- function onMarkerClick(e:MapMouseEvent):void
- {
- var businessMarker:Marker = Marker(e.currentTarget);
- var xml:XML = markersInfo[businessMarker];
- detailName.text = xml.name;
- detailStreet.text = xml.street;
- detailCity.text = xml.city;
- detailCountryPost.text = xml.country + ", " + xml.postcode;
- detailPhonenumber.text = xml.phonenumber;
- detailEmail.text = xml.email;
- detailWebsite.text = xml.website;
- detailDescription.text = xml.description;
- detailDescription.visible=true;
- descTitle.visible=true;
- facebookURL = xml.facebookid;
- twitterURL = xml.twitterid;
- youtubeURL = xml.youtubeid;
- flickrURL = xml.flickrid;
- detailLogo.source = "/logos/" + xml.businessid + ".jpg";
- detailLogo.visible=true;
- var html:String = "<b>" + xml.name + "</b><br/>" + xml.street +
- "<br/>" + xml.city + "<br/>" + xml.country + ", " + xml.postcode;
- businessMarker.openInfoWindow(new InfoWindowOptions({contentHTML:html}));
- emailDisplay();
- websiteDisplay();
- facebookIcon();
- twitterIcon();
- youtubeIcon();
- flickrIcon();
- }
- private function toggleHotel():void
- {
- for(businessMarker in markersInfo)
- {
- if(businessMarker.type=="Hotel")
- {
- businessMarker.visible = !marker.visible;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment