Bonjour,
j'ai un petit problème de correspondance entre de l'actionScript et du flex.
Voila mon mxml :
et j'ai un fichier AS derrière qui permet de mettre les colonnes dans un datagrid, ainsi que de mettre en forme mes labels.Code:
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 <?xml version="1.0" encoding="utf-8"?> <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" width="800" height="800" creationComplete="init();" title="Administration" showCloseButton="true" close="onClose();" titleIcon="@Embed('assets/logoBull.png')"> <mx:Script source="scripts/composantAdministration.as"></mx:Script> <mx:ToggleButtonBar dataProvider="ensembleVues" id="tg_barre" width="100%"></mx:ToggleButtonBar> <mx:ViewStack id="ensembleVues" width="750" height="700"> <mx:Canvas label="Personnes" width="100%" height="100%"> <mx:VBox> <mx:HBox> <mx:Label text="Gestion des personnes" id="labelPersonne"/> <mx:ComboBox id="comboPersonne"/> </mx:HBox> <mx:HBox> <mx:DataGrid id="tablePersonne"/> <mx:VBox> <mx:Button id="btnPersEnregistrer" label="Enregistrer" width="125" click="clickHandlerYesNoModificationPersonnel()"/> <mx:Button id="btnPersNouveau" label="Nouveau" width="125" click="callServiceAjoutePersonnePersonnel2()"/> <mx:Button id="btnPersSupprimer" label="Supprimer" width="125" click="clickHandlerYesNoSuppressionPersonnel()"/> </mx:VBox> </mx:HBox> </mx:VBox> </mx:Canvas> <mx:Canvas label="Groupes" width="100%" height="100%"> <mx:Label text="Gestion des groupes" id="labelGroupe"/> </mx:Canvas> </mx:ViewStack> </mx:TitleWindow>
voici le fichier AS :
Tout cela marche bien, sauf pour mon labelGroupe. il est dans le second canvas, et je ne peux rien faire dessus. voici le message d'erreur que j'ai :Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 private function creationOngletPersonnel(e:Event):void { labelPersonne.setStyle("fontWeight","bold"); labelPersonne.setStyle("fontSize","18"); tablePersonne.rowHeight=26; tablePersonne.doubleClickEnabled=true; tablePersonne.height=500; tablePersonne.setStyle("textAlign", TextFormatAlign.CENTER); ....... } private function creationOngletGroupe():void { labelGroupe.setStyle("fontWeight","bold"); labelGroupe.setStyle("fontSize","18"); }
quelqu'un voit il pourquoi ?Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 TypeError: Error #1009: Il est impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul. at composantAdministration/creationOngletGroupe()[D:\Documents and Settings\e-guerin-f\Bureau\workspace\modAdministration\src\scripts\composantAdministration.as:249] at composantAdministration/init()[D:\Documents and Settings\e-guerin-f\Bureau\workspace\modAdministration\src\scripts\composantAdministration.as:44] at composantAdministration/___composantAdministration_TitleWindow1_creationComplete()[D:\Documents and Settings\e-guerin-f\Bureau\workspace\modAdministration\src\composantAdministration.mxml:2] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9298] at mx.core::UIComponent/set initialized()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1169] at mx.managers::LayoutManager/validateClient()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:937] at mx.core::UIComponent/validateNow()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5679] at mx.managers::PopUpManagerImpl/centerPopUp()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:437] at mx.managers::PopUpManager$/centerPopUp()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\PopUpManager.as:184] at modAdministration/init()[D:\Documents and Settings\e-guerin-f\Bureau\workspace\modAdministration\src\scripts\modAdministration.as:7] at modAdministration/___modAdministration_Application1_creationComplete()[D:\Documents and Settings\e-guerin-f\Bureau\workspace\modAdministration\src\modAdministration.mxml:2] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9298] at mx.core::UIComponent/set initialized()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1169] at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:718] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8628] at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8568]
merci d'avance :)
florian