-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathGPS.as
More file actions
123 lines (103 loc) · 2.72 KB
/
GPS.as
File metadata and controls
123 lines (103 loc) · 2.72 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
package componentStatic
{
import appManager.animatedPages.MainAnim;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Rectangle;
import flash.utils.clearTimeout;
import flash.utils.setTimeout;
import map.AddMarker;
import map.DisplayMapOption;
import map.GeoLocation;
import map.MapEvent;
import map.Marker;
import stageManager.StageManager;
public class GPS extends ComponentManager
{
private var mapAreaMc:MovieClip,
setLocationMc:MovieClip;
private var addmarker:AddMarker;
private var _idTimeOut:uint;
public function GPS()
{
super();
mapAreaMc = Obj.get('mapArea_mc',this)
setLocationMc =Obj.get('setLocatoin_mc',this)
if(setLocationMc!=null)
{
setLocationMc.addEventListener(MouseEvent.CLICK,setlocatoin_fun)
}
}
protected function setlocatoin_fun(event:MouseEvent):void
{
if(GeoLocation.marker!=null)
{
heideMap()
addNewMarker(GeoLocation.marker)
}
}
public function showMap(event=null):void
{
if(mapAreaMc!=null)
{
var marker:Marker=null;
if(DevicePrefrence.isItPC)
{
marker = new Marker(35.7137559,51.4149215)
}
else if(GeoLocation.marker!=null)
{
marker = GeoLocation.marker
}
if(getObj('Lat')!=null && getObj('Lon')!=null)
{
marker = new Marker(getObj('Lat'),getObj('Lon'))
}
if(marker!=null)
{
addNewMarker(marker)
clearTimeout(_idTimeOut)
}
else
{
clearTimeout(_idTimeOut)
_idTimeOut = setTimeout(showMap,2000)
trace('time out')
}
}
}
private function addNewMarker(Marker_p:Marker):void
{
error(setObj('Lat',Marker_p.lat))
error(setObj('Lon',Marker_p.lng))
var markerList:Vector.<Marker>= new Vector.<Marker>()
markerList.push(Marker_p)
mapAreaMc.visible = false
addmarker = new AddMarker(markerList)
var displayMap:DisplayMapOption = new DisplayMapOption()
displayMap.marker = true
displayMap.area = mapAreaMc.getBounds(this.stage)
displayMap.markerAndPanTo = true
displayMap.defaultZoom = 16
displayMap.showAllMarker = false
displayMap.fullScreenArea = new Rectangle(0,0-(StageManager.stageDelta.height/2),768,1024+StageManager.stageDelta.height)
addmarker.setup(this,displayMap)
addmarker.addEventListener(MapEvent.GET_MARKER_LIST,markerList_fun)
}
public function heideMap():void
{
if(addmarker!=null)
{
addmarker.hideMap()
addmarker = null
}
}
protected function markerList_fun(event:MapEvent):void
{
var _marker:Marker = event.makerList[event.makerList.length-1]
error(setObj('Lat',_marker.lat))
error(setObj('Lon',_marker.lng))
}
}
}