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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?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" viewSourceURL="srcview/index.html">
<mx:Panel title="Google Maps Geocoding Demo" width="100%" height="100%">
<mx:VBox width="100%" height="100%">
<mx:HBox width="100%" height="25">
<mx:Label
text="Enter address: "/>
<mx:TextInput
id="address"
text="Sydney AU"
dropShadowColor="0x000000"
enter="doGeocode(event);"
/>
<mx:Button
id="submitButton" label="Search"
click="doGeocode(event);"
/>
</mx:HBox>
<maps:Map
id="map"
key="ABQIAAAA7QUChpcnvnmXxsjC7s1fCxQGj0PqsCtxKvarsoS-iqLdqZSKfxTd7Xf-2rEc_PC9o8IsJde80Wnj4g"
mapevent_mapready="onMapReady(event)"
width="100%" height="100%"/>
</mx:VBox>
</mx:Panel>
<mx:Script>
<![CDATA[
import com.google.maps.services.ClientGeocoderOptions;
import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapMouseEvent;
import com.google.maps.MapType;
import com.google.maps.services.ClientGeocoder;
import com.google.maps.services.GeocodingEvent;
import com.google.maps.overlays.Marker;
import com.google.maps.overlays.MarkerOptions;
import com.google.maps.InfoWindowOptions;
import mx.controls.Alert;
import com.google.maps.controls.ZoomControl;

private function onMapReady(event:Event):void {
map.enableScrollWheelZoom();
map.enableContinuousZoom();
map.addControl(new ZoomControl());
}

private function doGeocode(event:Event):void {
// Geocoding example
var geocoder:ClientGeocoder = new ClientGeocoder();

geocoder.addEventListener(
GeocodingEvent.GEOCODING_SUCCESS,
function(event:GeocodingEvent):void {
var placemarks:Array = event.response.placemarks;
if (placemarks.length > 0) {
map.setCenter(placemarks[0].point);
var marker:Marker = new Marker(placemarks[0].point);

marker.addEventListener(MapMouseEvent.CLICK, function (event:MapMouseEvent):void {
marker.openInfoWindow(new InfoWindowOptions({content: placemarks[0].address}));
});
map.addOverlay(marker);
}
});
geocoder.addEventListener(
GeocodingEvent.GEOCODING_FAILURE,
function(event:GeocodingEvent):void {
Alert.show("Geocoding failed");
trace(event);
trace(event.status);
});
geocoder.geocode(address.text);
}
]]>
</mx:Script>
</mx:Application>

Show details Hide details

Change log

r252 by pamela.fox on Nov 21, 2008   Diff
[No log message]
Go to: 
Project members, sign in to write a code review

Older revisions

r190 by pamela.fox on Oct 02, 2008   Diff
Committing changed examples for 1.7
r33 by pamela.fox on May 14, 2008   Diff
Geocoding trace
r23 by pamela.fox on May 14, 2008   Diff
Geocoding layout
All revisions of this file

File info

Size: 2902 bytes, 82 lines

File properties

svn:executable
*
Hosted by Google Code