bonjour,

avez-vous déjà rencontrer ce phénomène :

J'ai un contrôles à onglet, il a 2 pages.
Dans la premiere je mets un data grid, et dans l'autre je mets autre chose.
j'ai une fonction sur CreationComplete qui remplit le datagrid
ça marche.
Tout est ok.
Je décide de mettre l'onglet 2 avant l'onglet 1 (ainsi l'onglet où le datagrid est disposé n'est plus visible)

je lance l'appli et ...bug :
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 planning/charger()[F:\flex3\planning\src\planning.mxml:26]
at planning/___planning_Application1_creationComplete()[F:\flex3\planning\src\planning.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]
je remets l'onglet avec le datagrid en tête, je lance et ça marche !

j'ai l'impression que les objets accesibles sont limités dans l'event CreationComplete...

étrange...

voilà mes contrôles :
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
<mx:TabNavigator x="19" y="27" width="1019" height="591">
		<mx:Canvas label="Données" width="100%" height="100%">
			<mx:DataGrid  id="datagrid_calevent_item"  x="10" y="36" width="100%">				
					</mx:DataGrid>
			<mx:Label x="10" y="10" text="calevent_item"/>
		</mx:Canvas>		
		<mx:Canvas label="Interface" width="100%" height="100%">
			<mx:DateChooser x="606" y="24" id="calendrier" change="maj_calendrier()"
				showToday="true" firstDayOfWeek="1" 
				dayNames="[Di, Lu, Ma, Me, Je, Ve, Sa]"
				monthNames="[Janvier, Février, Mars, Avril, Mai, Juin, Juillet, Août, Septembre, Octobre, Novembre, Décembre]"/>
			<mx:Label x="190" y="51" text="Semaine n°" id="label_semaine"/>
			<mx:Label x="37" y="84" text="Lundi" id="label_lundi"/>
			<mx:Label x="116" y="84" text="Mardi" id="label_mardi"/>
			<mx:Label x="190" y="84" text="Mercredi" id="label_mercredi"/>
			<mx:Label x="270" y="84" text="Jeudi" id="label_jeudi"/>
			<mx:Label x="336" y="84" text="Vendredi" id="label_vendredi"/>
			<mx:Label x="421" y="84" text="Samedi" id="label_samedi"/>
			<mx:Label x="491" y="84" text="Dimanche" id="label_dimanche"/>
		</mx:Canvas>
 
	</mx:TabNavigator>
et mon entête :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="charger(event)">