= 240) {
var i:PinMapIcon = (p.icon as PinMapIcon);
i.iconWidth = 48;
p.icon = i;
}
this.parentApplication.removeShapesFromMap();
this._sc = new ShapeCollection();
this._sc.name = "searchShapeCollection";
this._sc.add(p);
this.parentApplication.map.addShapeCollection(this._sc);
this.parentApplication.map.bestFit(false,2,16);
if (this.navigator) this.navigator.pushView(MapsView);
}
private function onViewDeactivate():void {
this._data = null;
this._addrString = null;
this._distString = null;
this._tu = null;
this._sc = null;
}
private function makeAddressString():void {
this._addrString = new String();
if (this._data.fields.Address) this._addrString += this._data.fields.Address + "\n";
if (this._data.fields.City) {
this._addrString += this._data.fields.City;
if (this._data.fields.State) this._addrString += ", ";
}
if (this._data.fields.State) this._addrString += this._data.fields.State;
if (this._data.fields.ZIP) this._addrString+= " " + this._data.fields.ZIP;
}
private function makeDistanceString():void {
this._distString = new String();
if (this._data.distance) {
this._distString += "\n" + this._data.distance.toFixed(2);
if (this.parentApplication.distanceUnit == DistanceUnits.MILES) {
this._distString += " mi";
}
else {
this._distString += " km";
}
this._distString += " from search location";
}
}
private function prepEmail():void {
navigateToURL(new URLRequest("mailto:?subject=Location Information&body=" + this._data.name + "\n" + this._addrString + "\n\n" + this._distString));
}
private function getDirections(type:String):void {
this.parentApplication.directionsLocations = ["",""];
if (type == "to") {
if (this._data.fields) {
this.parentApplication.directionsLocations[1] = this._addrString.replace("\n"," ");
}
else {
this.parentApplication.directionsLocations[1] = "latlng " + this._data.latLng;
}
}
else {
if (this._data.fields) {
this.parentApplication.directionsLocations[0] = this._addrString.replace("\n"," ");
}
else {
this.parentApplication.directionsLocations[0] = "latlng " + this._data.latLng;
}
}
if (this.navigator) this.navigator.pushView(DirectionsView);
}
private function doAction(e:MouseEvent):void {
var o:Object = this.alActions.getItemAt(List(e.currentTarget).selectedIndex);
if (this.navigator) {
switch (o.name) {
case "View on Map":
this.parentApplication.toggleBusyIndicator(true,this);
this.onShowOnMapClick();
break;
case "Directions To Here":
this.getDirections("to");
break;
case "Directions From Here":
this.getDirections("from");
break;
case "Call " + this._tu.formatPhone(this._data.fields.Phone):
navigateToURL(new URLRequest('tel:' + this._data.fields.Phone));
break;
case "Email Information":
this.prepEmail();
break;
}
}
}
]]>