My favorites | Sign in
Project Logo
                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2007 Google Inc. -->
<!-- All Rights Reserved. -->

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:maps="com.google.maps.*"
width="100%" height="100%" layout="absolute">
<mx:Panel title="Google Maps Geocoding Demo" width="100%" height="100%">
<maps:Map
id="map"
key="ABQIAAAA7QUChpcnvnmXxsjC7s1fCxQGj0PqsCtxKvarsoS-iqLdqZSKfxTd7Xf-2rEc_PC9o8IsJde80Wnj4g"
mapevent_mapready="onMapReady(event)"
width="100%" height="100%"/>
</mx:Panel>
<mx:Script>
<![CDATA[
import com.google.maps.LatLng;
import com.google.maps.MapEvent;
import com.google.maps.Map;
import com.google.maps.services.*;

private var dir:Directions;

private function onMapReady(event:MapEvent):void {
map.setCenter(new LatLng(42.351505,-71.094455), 15);
dir = 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)");
}

private function onDirFail(event:DirectionsEvent):void {
// Process failure, perhaps by showing an alert
}

private function onDirLoad(event:DirectionsEvent):void {
var dir:Directions = event.directions;

map.clearOverlays();
map.addOverlay(dir.createPolyline());
}
]]>
</mx:Script>
</mx:Application>
Show details Hide details

Change log

r190 by pamela.fox on Oct 02, 2008   Diff
Committing changed examples for 1.7
Go to: 
Project members, sign in to write a code review

Older revisions

r148 by pamela.fox on Aug 15, 2008   Diff
Adding DirectionsSimple to examples
folder. Hoping key is correct.
All revisions of this file

File info

Size: 1568 bytes, 43 lines
Hosted by Google Code