Précédent   Forum du club des développeurs et IT Pro > Webmasters - Développement Web > Flash/Flex
Flash/Flex Forum d'entraide sur les technologies Flash et Flex
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 19/05/2012, 23h31   #1
win8infos
Invité de passage
 
Homme Claude Bernardini
Consultant informatique
Inscription : avril 2012
Messages : 1
Détails du profil
Informations personnelles :
Nom : Homme Claude Bernardini
Localisation : France

Informations professionnelles :
Activité : Consultant informatique
Secteur : Boutique - Magasin

Informations forums :
Inscription : avril 2012
Messages : 1
Points : 0
Points : 0
Par défaut Affichage dans appli GPS en Flash Builder

Salut,

J'ai un pb d'affichage assez incompréhensible dans une application GPS que je développe en Flash Builder.

Voici le topo (un peu simplifié par raport à mon appli réelle):
- Clic sur le bouton "Démarrer Saisie GPS" (btStartGPS) pour initialiser le GPS
- Lorsque le GPS est initialisé, les coordonnées et la précision s'affichent bien dans les zones txtLat, txtLong et txtPrecision.
- L'utilisateur clique sur le bouton "Capturer Coordonnée" (cmdGetCoord) pour capturer les coordonnées courantes.
- Là, un compteur s'incrémente et sa valeur doit s'afficher dans la zone txtNbPoints.

Et là : Ca fonctionne bien dans l'environnement de test sur PC, mais lorsque je teste l'APK sur un Android : niet. La zone txtNbPoints reste vide ! Alors que les zones txtLat, txtLong et txtPrecision sont correctement affichées.
L'astuce que j'ai trouvé est de sortir de l'appli Android puis d'y revenir pour que l'affichage fonctionne correctement !
J'ai essayé aussi de gérer l'affichage de txtNbPoints avec un Data Binding, mais c'est pire puisque l'astuce de sortir de l'appli et d'y revenir ne fonctionne plus.
J'ai aussi essayé d'utiliser les méthodes invalidateDisplayList() et stage.invalidate() dans ma fonction GetCoord() mais çà ne change rien.

Bref, je n'y comprends rien !

Si quelqu'un a une idée, elle est la bienvenue


Voici la source simplifiée de ma view MXML :
Code xml :
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
<?xml version="1.0" encoding="utf-8"?>
 
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
		xmlns:s="library://ns.adobe.com/flex/spark"
		xmlns:components="tv.digitalretro.components.*"
		title="GPS" >
	<fx:Script>
		<![CDATA[
			import flash.events.Event;
			import flash.events.StatusEvent;
			import flash.sensors.Geolocation;
 
			import mx.events.ItemClickEvent;
 
			private var geoLoc:Geolocation;
			private var nbCoords:uint =0;
 
			[Bindable]
			private var MemoLong:Number = 0;
			[Bindable]
			private var MemoLat:Number = 0;
			[Bindable]
			private var MemoPrecision:Number = 0;
 
 
			private function StartGPS(evt:Event):void {
				if (Geolocation.isSupported) {
					busy.visible = true;
					geoLoc = new Geolocation();
					geoLoc.setRequestedUpdateInterval(1000);
					geoLoc.addEventListener(GeolocationEvent.UPDATE, geolocationUpdateHandler);
				}
			}
 
			private function geolocationUpdateHandler(event:GeolocationEvent):void {
				if (!GrpGPS.visible) {
					GrpGPS.visible = true;
					busy.visible = false;
				}
				MemoLong = event.longitude; MemoLat = event.latitude;
				MemoPrecision = event.horizontalAccuracy;
			}
 
 
			private function GetCoord(evt:Event):void {
				if (MemoLong != 0) {
					nbCoords ++;
					txtNbPoints.text = nbCoords.toString();
 
					//GrpGPS.invalidateDisplayList();
					GrpGPS.stage.invalidate();
				}
			}
 
			private function StopCoord(evt:Event):void {
				if (Geolocation.isSupported) { geoLoc.removeEventListener(GeolocationEvent.UPDATE, geolocationUpdateHandler); }
				MemoLong = MemoLat = MemoPrecision = 0;
				txtNbPoints.text = "";
				GrpGPS.visible = false;
			}
 
 
	]]>
	</fx:Script>
 
	<fx:Declarations>
		<!-- Placer ici les éléments non visuels (services et objets de valeur, par exemple). -->
	</fx:Declarations>
 
	<s:Label x="11" y="82" fontSize="12" text="Latitude :"/>
	<s:Label x="9" y="118" fontSize="12" text="Longitude :"/>
	<s:Label x="11" y="161" fontSize="12" text="Précision horizontale :"/>
	<s:TextInput id="txtLat" x="87" y="71" width="101" height="29" fontSize="11" text="{MemoLat.toFixed(5) + '°'}"/>
	<s:TextInput id="txtLong" x="88" y="108" width="100" height="29" fontSize="11" text="{MemoLong.toFixed(5) + '°'}"/>
	<s:TextInput id="txtPrecision" x="141" y="146" width="83" height="29" fontSize="11" text="{MemoPrecision.toString() + ' m'}"/>
	<s:Label x="16" y="334" color="#CC1212" fontWeight="bold" text="Pas de support GPS !" id="lblNoGPS" visible="false"/>
 
	<s:Button id="btStartGPS" x="10" y="34" height="27" label="Démarrer Saisie GPS" fontSize="12" click="StartGPS(event);"/>
 
	<s:Group id="GrpGPS" x="7" y="184" width="301" height="129" visible="false">
		<s:Button id="cmdGetCoord" x="10" y="10" width="179" height="37" label="Capturer Coordonnée"
				  color="#098824" fontSize="14" click="GetCoord(event)"/>
		<s:Button id="cmdStopCoord" x="219" y="10" width="62" height="37" label="Stop"
				  color="#A20A0A" fontSize="14" click="StopCoord(event)"/>
		<s:Label x="7" y="70" fontSize="12" text="Nb Points :"/>
		<s:TextInput id="txtNbPoints" x="76" y="59" width="37" height="29" fontSize="11" /> <!-- text="{OnAddCoord()}" -->
	</s:Group>
 
	<s:BusyIndicator id="busy" x="144" y="268" visible="false"/>
 
</s:View>
win8infos est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 10h17.


 
 
 
 
Partenaires

Hébergement Web