Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This here just assigns an image to each marker based on type, then it prints the marker and when I click the marker it sets off a function to display the information in the tab below the map.
- protected function getBusiness_resultHandler(event:ResultEvent):void
- {
- var xml:XML = new XML(event.result as String);
- //businessListCol = new XMLListCollection (xml.business);
- businessList = xml.business;
- for (var i:int=0; i<businessList.length(); i++)
- {
- if (businessList[i].type=="Hotel")
- {
- var bm:Bitmap = new Hotel as Bitmap;
- }
- else if (businessList[i].type=="Hostel")
- {
- var bm:Bitmap = new Hostel as Bitmap;
- }
- else if (businessList[i].type=="Pharmacy")
- {
- var bm:Bitmap = new Pharmacy as Bitmap;
- }
- else if (businessList[i].type=="Restaurant")
- {
- var bm:Bitmap = new Restaurant as Bitmap;
- }
- else if (businessList[i].type=="Supplies")
- {
- var bm:Bitmap = new Supplies as Bitmap;
- }
- else if (businessList[i].type=="Work")
- {
- var bm:Bitmap = new Work as Bitmap;
- }
- else
- {
- var bm:Bitmap = new Bike as Bitmap;
- }
- var html:String = "<b>" + businessList[i].name + "</b><br/>" + businessList[i].street + "<br/>" + businessList[i].city + "<br/>" + businessList[i].country + ", " + businessList[i].postcode;
- var imageURL:String;
- var imageURL2:String;
- var businessMarker:Marker = new Marker(new LatLng(businessList[i].latitude,businessList[i].longitude),
- new MarkerOptions({icon:bm, iconOffset: new Point (-23, -44)}));
- businessMarker.addEventListener(MapMouseEvent.CLICK, function(e:MapMouseEvent):void {
- Marker(e.currentTarget).openInfoWindow(new InfoWindowOptions({contentHTML:htmlDict[e.currentTarget]}));
- detailName.text = nameDict[e.currentTarget];
- detailStreet.text = streetDict[e.currentTarget];
- detailCity.text = cityDict[e.currentTarget];
- detailCountryPost.text = countryDict[e.currentTarget];
- detailPhonenumber.text = phonenumberDict[e.currentTarget];
- detailEmail.text = emailDict[e.currentTarget];
- detailWebsite.text = websiteDict[e.currentTarget];
- detailDescription.text = descriptionDict[e.currentTarget];
- detailDescription.visible=true;
- descTitle.visible=true;
- facebookURL = facebookidDict[e.currentTarget];
- twitterURL = twitteridDict[e.currentTarget];
- youtubeURL = youtubeidDict[e.currentTarget];
- flickrURL = flickridDict[e.currentTarget];
- imageURL = idDict[e.currentTarget];
- detailLogo.source = "/logos/" + imageURL + ".jpg";
- detailLogo.visible=true;
- emailDisplay();
- websiteDisplay();
- facebookIcon();
- twitterIcon();
- youtubeIcon();
- flickrIcon();
- });
- htmlDict[businessMarker] = html;
- idDict[businessMarker] = businessList[i].businessid;
- typeDict[businessMarker] = businessList[i].type;
- nameDict[businessMarker] = businessList[i].name;
- streetDict[businessMarker] = businessList[i].street;
- cityDict[businessMarker] = businessList[i].city;
- countryDict[businessMarker] = businessList[i].country + ", " + businessList[i].postcode;
- phonenumberDict[businessMarker] = businessList[i].phonenumber;
- emailDict[businessMarker] = businessList[i].email;
- websiteDict[businessMarker] = businessList[i].website;
- descriptionDict[businessMarker] = businessList[i].description;
- facebookidDict[businessMarker] = businessList[i].facebookid;
- twitteridDict[businessMarker] = businessList[i].twitterid;
- youtubeidDict[businessMarker] = businessList[i].youtubeid;
- flickridDict[businessMarker] = businessList[i].flickrid;
- Map.addOverlay(businessMarker);
- }
- }
- //Here is the function that I will call when a box changes. For the moment I'm doing a function just for Hotel check box, but later I may get all check boxes to call the function and just pass the value 'Hotel' etc
- private function toggleHotel():void {
- for (var i:Number = 0; i < *******; i++) {
- if (!marker.visible) {
- marker.visible = true;
- } else {
- marker.visible = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment