I would suggest throwing an alert (like the comment says) in the failure handler to see if your Directions request is actually successful, but the code does look alright.
The example works fine. It draws a polyline along the directional route showing the directions. It doesn't have a info window so it may be hard to see. -Arothian On Apr 27, 2:25 pm, nielsmus <[email protected]> wrote: > Hey, > > Could anyone tell me why this code is working just fine when i test it > localy but once i put it online it just shows the map but does not > load the directions. > > I got this code from > here:http://code.google.com/intl/nl/apis/maps/documentation/flash/services... > > and if i check the preview there its not working either. > > Any ideas? > > function onMapReady(event:MapEvent):void { > map.setCenter(new LatLng(42.351505,-71.094455), 13); > map.addControl(new ZoomControl()); > > // Create a directions object > var dir:Directions = new Directions(); > dir.addEventListener(DirectionsEvent.DIRECTIONS_SUCCESS, onDirLoad); > dir.addEventListener(DirectionsEvent.DIRECTIONS_FAILURE, onDirFail); > dir.load("77 Massachusetts Avenue, Cambridge, MA to 4 Yawkey Way, > Boston, MA 02215 (Fenway Park)"); > > } > > function onDirFail(event:DirectionsEvent):void { > // Process failure, perhaps by showing an alert > > } > > function onDirLoad(event:DirectionsEvent):void { > var dir:Directions = event.directions; > > map.clearOverlays(); > map.addOverlay(dir.createPolyline()); > > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API For Flash" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-maps-api-for-flash?hl=en -~----------~----~----~----~------~----~------~--~---
