Bonjour à tous,

Je me penche actuellement sur un module d'inscription qui tente d'avertir l'utilisateur lorsque le pseudo est déjà utilisé...
Pour cela j'utilise un composant à trois états :
  • un état neutre ;
  • un état qui indique que le pseudo est déjà utilisé ;
  • et vice et versa.


Le problème est que l'un des deux états non neutres ne fonctionne pas...

Voilà mon 'tit bout de code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/halo"
			   width="10" height="10"
			   creationComplete="init()">
 
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
 
	<s:states>
		<s:State name="right"/>
		<s:State name="wrong"/>
		<s:State name="none"/>
	</s:states>
 
	<fx:Script>
		<![CDATA[
 
			import gunsailor.constellation.loader.Load;
			import gunsailor.constellation.events.LoadingEvent;
			import mx.controls.Alert;
 
			private var loader:Load;
			private var loader1:Load;
 
			private function init():void
			{
				this.currentState = "none";
 
				loader = new Load("./assets/wrong.gif");
 
				loader.addEventListener ( LoadingEvent.FINISHED, Wrong);
 
				loader1 = new Load("./assets/right.gif");
 
				loader1.addEventListener ( LoadingEvent.FINISHED, Yes);
			}
 
			private function Wrong(e:LoadingEvent):void
			{
				wrong.addElement(e.value);
 
				loader.removeEventListener ( LoadingEvent.FINISHED, Wrong);
			}
 
			private function Yes(e:LoadingEvent):void
			{
				right.addElement(e.value);
 
				loader1.removeEventListener(LoadingEvent.FINISHED, Yes);
			}
 
		]]>
	</fx:Script>
	<s:Group id="wrong" includeIn="wrong">
	</s:Group>
	<s:Group id="right" includeIn="right">
	</s:Group>
</s:Group>
Et voici comment je l'utilise :

si(...)alors monComposant.currentstate="wrong"
sinon monComposant.currentstate="right"
Est-ce que quelqu'un peut venir à ma rescousse ?
Merci d'avance.