IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Flex Discussion :

Erreur systématique lors d'un premier changement d'état


Sujet :

Flex

  1. #1
    Membre habitué Avatar de ToniConti
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2009
    Messages
    245
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Novembre 2009
    Messages : 245
    Points : 162
    Points
    162
    Par défaut Erreur systématique lors d'un premier changement d'état
    Bonjour à tous

    J'utilise flex depuis pas mal de temps mais à chaque fois une chose m'échappe.
    Je vous soumet mon problème en espérant que quelqu'un pourra m'aider à y voir plus clair.

    Cette erreur se manifeste à chaque fois que j'utilise les états de l'application.
    Celle-ci dispose d'un bouton lui permettant de changer d'état.

    Or voici ce qui se produit à chaque premier clic sur ce bouton :
    - une erreur se déclenche (référence nulle)
    - l'application ne change pas d'état.

    Tous les autres clics sur ce bouton :
    - pas d'erreur
    - le changement d'état s'opère
    - la transition se déroule correctement

    Le swf est disponible en pièces jointes et en voici le code source :
    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
    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
     
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" height="100%" width="100%">
     
    	<mx:Script>
    		<![CDATA[
     
    			public function AjouterPrestation():void
    			{
    				pPrestations.enabled = false;
    				pPeriode.enabled = false;
    				vStack.selectedIndex = 1;
    				ajouterDate.selectedDate = date.selectedDate;
    				currentState = "stateEffect";
    			}
     
    			public function Retour():void
    			{
    				vStack.selectedIndex = 0;
    				pPrestations.enabled = true;
    				pSelection.enabled = false;
    				pPeriode.enabled = true;
    				this.currentState = "";
    			}
     
    		]]>
    	</mx:Script>	
     
    	<mx:states>
    		<mx:State name="stateEffect">
    			<mx:SetProperty target="{vStack}" name="width" value="1000"/>
    			<mx:SetProperty target="{selectionTaches}" name="width" value="850"/>
    			<mx:SetProperty target="{selectionRemarque}" name="width" value="450"/>
    			<mx:SetProperty target="{ajouterTaches}" name="width" value="850"/>
    			<mx:SetProperty target="{ajouterRemarque}" name="width" value="450"/>
    			<mx:SetProperty target="{c2}" name="visible" value="false"/>
    			<mx:SetProperty target="{c3}" name="visible" value="false"/>
    			<mx:SetProperty target="{c4}" name="visible" value="false"/>
    			<mx:SetProperty target="{c6}" name="visible" value="false"/>
    		</mx:State>
    	</mx:states>
     
    	<mx:transitions>
    		<mx:Transition fromState="*" toState="*">
    			<mx:Sequence targets="{[pPrestations, vStack, selectionTaches, ajouterTaches, selectionTaches, ajouterRemarque]}">
    				<mx:Blur blurYFrom="0" blurYTo="10" duration="100" filter="move"/>
    				<mx:Parallel >
    					<mx:Move/>
    					<mx:Resize/>
    				</mx:Parallel>
    				<mx:Blur blurYFrom="10" blurYTo="0" duration="100" filter="move"/>
    			</mx:Sequence>
    		</mx:Transition>
    	</mx:transitions>
     
    	<mx:HBox id="app" height="100%" width="100%">
     
    		<mx:Panel id="pPeriode" title="Période" layout="vertical">
    			<mx:DateChooser id="date"/>
    		</mx:Panel>
     
    		<mx:Panel id="pPrestations" title="Prestations" height="100%" width="100%" layout="vertical">
    			<mx:DataGrid id="listePrestations" height="100%" width="100%">
    				<mx:columns>
    					<mx:DataGridColumn id="c1" headerText="Jour" dataField="jour" width="70"/>
    					<mx:DataGridColumn id="c2" headerText="Date" dataField="date" width="90"/>
    					<mx:DataGridColumn id="c3" headerText="Durée" dataField="duree" width="60"/>
    					<mx:DataGridColumn id="c4" headerText="Etape" dataField="etape" width="180"/>
    					<mx:DataGridColumn id="c5" headerText="Tâche" dataField="tache" width="350"/>
    					<mx:DataGridColumn id="c6" headerText="Remarque" dataField="remarque"/>
    				</mx:columns>
    			</mx:DataGrid>
    			<mx:HBox width="100%">
    				<mx:Label id="statut"/>
    				<mx:Spacer width="100%"/>
    				<mx:LinkButton id="boutonAjouterPrestation" label="Ajouter une prestation" click="AjouterPrestation()"/>
    			</mx:HBox>
    		</mx:Panel>
     
    		<mx:ViewStack id="vStack" minWidth="289">
     
    			<mx:Panel id="pSelection" title="Agir sur la sélection" enabled="false">
    				<mx:Form>
    					<mx:FormItem label="Tâche">
    						<mx:ComboBox id="selectionTaches" labelField="NomTache" width="160" rowCount="25"/>
    					</mx:FormItem>
    					<mx:FormItem label="Date">
    						<mx:DateField id="selectionDate" formatString="DD/MM/YYYY"/>
    					</mx:FormItem>
    					<mx:FormItem label="Heures">
    						<mx:NumericStepper id="selectionHeures" value="0" minimum="0" maximum="8" stepSize="1"/>
    					</mx:FormItem>
    					<mx:FormItem label="Minutes">
    						<mx:NumericStepper id="selectionMinutes" value="0" minimum="0" maximum="60" stepSize="5"/>
    					</mx:FormItem>
    					<mx:FormItem label="Remarque">
    						<mx:TextArea id="selectionRemarque" height="80"/>
    					</mx:FormItem>
    				</mx:Form>
    				<mx:ControlBar>
    					<mx:Button label="Supprimer"/>
    					<mx:Spacer width="100%"/>
    					<mx:Button label="Enregistrer"/>
    				</mx:ControlBar>
    			</mx:Panel>
     
    			<mx:Panel id="pAjouter" title="Ajouter une prestation">
    				<mx:Form>
    					<mx:FormItem label="Tâche">
    						<mx:ComboBox id="ajouterTaches" labelField="NomTache" width="160" rowCount="25"/>
    					</mx:FormItem>
    					<mx:FormItem label="Date">
    						<mx:DateField id="ajouterDate" formatString="DD/MM/YYYY"/>
    					</mx:FormItem>
    					<mx:FormItem label="Heures">
    						<mx:NumericStepper id="ajouterHeures" value="0" minimum="0" maximum="8" stepSize="1"/>
    					</mx:FormItem>
    					<mx:FormItem label="Minutes">
    						<mx:NumericStepper id="ajouterMinutes" value="0" minimum="0" maximum="60" stepSize="5"/>
    					</mx:FormItem>
    					<mx:FormItem label="Remarque">
    						<mx:TextArea id="ajouterRemarque" height="80"/>
    					</mx:FormItem>
    				</mx:Form>
    				<mx:ControlBar>
    					<mx:Button label="Retour" click="Retour()"/>
    					<mx:Spacer width="100%"/>
    					<mx:Button id="boutonAjouter" label="Ajouter" enabled="false"/>
    				</mx:ControlBar>
    			</mx:Panel>
    		</mx:ViewStack>
    	</mx:HBox>
     
    </mx:Application>
    Pour ceux qui auront la bonté d'âme de tester ce code dans un nouveau projet, d'avance un grand merci !
    Fichiers attachés Fichiers attachés

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Août 2006
    Messages
    141
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Août 2006
    Messages : 141
    Points : 118
    Points
    118
    Par défaut
    Bonjour,

    Change ton code du viewstack en ajoutant ceci (rouge) :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <mx:ViewStack id="vStack" minWidth="289" creationPolicy="all">
    Bonne journée

  3. #3
    Membre habitué Avatar de ToniConti
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2009
    Messages
    245
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Novembre 2009
    Messages : 245
    Points : 162
    Points
    162
    Par défaut
    Merci beaucoup !
    Tout fonctionne parfaitement maintenant

    Bonne journée

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Stopper une Transaction lors de la premiere erreur.
    Par jeffray03 dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 30/09/2008, 16h19
  2. Erreur 2213 lors de l'aperçu d'un état
    Par tsp dans le forum VBA Access
    Réponses: 1
    Dernier message: 17/11/2007, 16h35
  3. [vba][excel]Erreur '1004' lors d'un changement d'opérateur de comparaison.
    Par nicko5959 dans le forum Macros et VBA Excel
    Réponses: 3
    Dernier message: 26/02/2007, 15h47
  4. Question facile, erreur bizzare lors d'un Left, Top
    Par SpiderAlpha dans le forum C++Builder
    Réponses: 4
    Dernier message: 05/05/2004, 12h56
  5. Erreur windows lors du malloc
    Par Elessar dans le forum C
    Réponses: 5
    Dernier message: 16/12/2003, 08h53

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo