fool5683
asked on
Trouble with Flash and Google Maps
Can someone please help me. I am in the process of building a Flash application the utilizes the Google Map APi. I have downloaded the following code:
import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import com.google.maps.InfoWindow Options;
import com.google.maps.LatLngBoun ds;
import com.google.maps.MapMoveEve nt;
import com.google.maps.overlays.M arker;
import com.google.maps.overlays.M arkerOptio ns;
import com.google.maps.interfaces .IPolyline ;
import com.google.maps.services.* ;
var dir:Directions;
var polyline:IPolyline;
var map:Map;
function setupMap()
{
map = new Map();
map.key ="ABQIAAAAjf2cvxDuc5J1E9Cr JXmy9RQrAB 2acdB4QgEQ tVMeGDLCPk NwtRR8XAwx 0MS9MI4RYm gwJ-jCIN9Q aQ";
map.setSize(new Point(400,400));
map.x = 0;
map.y = 0;
map.addEventListener(MapEv ent.MAP_RE ADY, onMapReady);
this.addChild(map);
}
setupMap();
function onMapReady(event:Event):vo id
{
dir = new Directions();
dir.addEventListener(Direc tionsEvent .DIRECTION S_SUCCESS, onDirectio nsLoaded);
dir.load("645 Carlton Road, Markham, ON to Fawnbrook Circle, Markham, ON");
}
function onDirectionsLoaded(event:D irectionsE vent):void
{
var returnedDirection:Directio ns = event.directions;
var startLatLng:LatLng = returnedDirection.getRoute (0).getSte p(0).latLn g;
var endLatLng:LatLng = returnedDirection.getRoute (returnedD irection.n umRoutes - 1).endLatLng;
polyline = returnedDirection.createPo lyline();
// Remove everything from map and add back the markers and polyline
map.clearOverlays();
map.addOverlay(polyline);
map.addOverlay(new Marker(startLatLng));
map.addOverlay(new Marker(endLatLng));
map.setCenter(returnedDire ction.boun ds.getCent er(), map.getBoundsZoomLevel(ret urnedDirec tion.bound s));
}
I am unable to generate a map but Iam getting the following error:
Line 36 1118: Implicit coercion of a value with static type com.google.maps.interfaces : IDirections to a possibly unrelated type com.google.maps.services: Directions
Can anyone help me with this issue?
import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import com.google.maps.InfoWindow
import com.google.maps.LatLngBoun
import com.google.maps.MapMoveEve
import com.google.maps.overlays.M
import com.google.maps.overlays.M
import com.google.maps.interfaces
import com.google.maps.services.*
var dir:Directions;
var polyline:IPolyline;
var map:Map;
function setupMap()
{
map = new Map();
map.key ="ABQIAAAAjf2cvxDuc5J1E9Cr
map.setSize(new Point(400,400));
map.x = 0;
map.y = 0;
map.addEventListener(MapEv
this.addChild(map);
}
setupMap();
function onMapReady(event:Event):vo
{
dir = new Directions();
dir.addEventListener(Direc
dir.load("645 Carlton Road, Markham, ON to Fawnbrook Circle, Markham, ON");
}
function onDirectionsLoaded(event:D
{
var returnedDirection:Directio
var startLatLng:LatLng = returnedDirection.getRoute
var endLatLng:LatLng = returnedDirection.getRoute
polyline = returnedDirection.createPo
// Remove everything from map and add back the markers and polyline
map.clearOverlays();
map.addOverlay(polyline);
map.addOverlay(new Marker(startLatLng));
map.addOverlay(new Marker(endLatLng));
map.setCenter(returnedDire
}
I am unable to generate a map but Iam getting the following error:
Line 36 1118: Implicit coercion of a value with static type com.google.maps.interfaces
Can anyone help me with this issue?
where is in your sample line 36?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
dgofman you are the man! I am attempting to develop a Flash application that will allow me to utilize the google map api to plot routes and distances. Your solution was awesome! I am going to start asking more questions to get this done as soon as possible! So stay tuned ...O Wise One:)