Repository navigation
Expand file tree
/
Copy pathMyInitialView.mxml
More file actions
147 lines (114 loc) · 3.81 KB
/
Copy pathMyInitialView.mxml
File metadata and controls
147 lines (114 loc) · 3.81 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<js:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:js="library://ns.apache.org/flexjs/basic"
xmlns:google="library://ns.apache.org/flexjs/google"
xmlns:local="*"
initComplete="initControls()">
<fx:Script>
<![CDATA[
import models.MyModel;
import org.apache.flex.events.Event;
private function initControls() : void
{
}
/**
* Take the values from the input field and have the map
* display that coordinate.
*/
private function mapIt() : void
{
var lat:Number = Number(latInput.text);
var lng:Number = Number(longInput.text);
var zoom:Number = Number(zoomInput.text);
map.loadMap(lat, lng, zoom);
}
private var selectedCity:String;
/**
* Triggered by a change in the drop list with a new city selected. This
* will also update the input fields.
*/
private function changeCity(event:org.apache.flex.events.Event) : void
{
var index:int = list.selectedIndex;
var latlng:Object = MyModel(applicationModel).coordinates[index];
map.loadMap(latlng.lat, latlng.lng, Number(zoomInput.text));
latInput.text = String(latlng.lat);
longInput.text = String(latlng.lng);
}
private function codeAddress() : void
{
map.markAddress(mapLocation.text);
map.setZoom(12);
}
private function searchOnMap() : void
{
map.nearbySearch(search.text);
map.setZoom(12);
}
private function clearSearchResults() : void
{
map.clearSearchResults();
}
private function orientMap() : void
{
map.centerOnAddress(mapLocation.text);
map.setZoom(12);
}
]]>
</fx:Script>
<fx:Style>
@namespace basic "library://ns.apache.org/flexjs/basic";
</fx:Style>
<js:beads>
<js:ViewDataBinding />
</js:beads>
<js:Container x="5" y="5" className="topContainer" >
<js:beads>
<js:VerticalLayout />
</js:beads>
<js:Container>
<js:beads>
<js:HorizontalLayout />
</js:beads>
<js:Label text="Location:" />
<js:TextInput id="mapLocation" />
<js:TextButton text="Go" click="orientMap()" />
</js:Container>
<google:Map id="map" width="450" height="300" token="AIzaSyDkQgg2iojLCYeuW6hK7DkuAHD-SwJJhdE" />
<js:Container>
<js:beads>
<js:HorizontalLayout />
</js:beads>
<js:Label text="Search on Map:" />
<js:TextInput id="search" />
<js:TextButton text="Find" click="searchOnMap()" />
<js:TextButton text="Clear" click="clearSearchResults()" />
</js:Container>
<js:Label text="History:" />
<!--<js:List id="historyList" />-->
<js:DropDownList id="list" width="100" height="17"
change="changeCity(event)"
dataProvider="{MyModel(applicationModel).cities}" />
<js:Label text="Lat:" />
<js:TextInput id="latInput" text="-34.397" />
<js:Label text="Long:" />
<js:TextInput id="longInput" text="150.644" />
<js:Label text="Zoom:" />
<js:TextInput id="zoomInput" text="8" />
<js:TextButton text="MapIt" click="mapIt()" />
</js:Container>
</js:View>