Salut à toi ami développeur,

Je vais synthétiser mon problème pour le clarifier, j'ai 3 fichiers MXML :


panelAlpha.mxml (un Panel)
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
 
<?xml version="1.0" encoding="utf-8"?>
<!--
	panelAlpha.mxml
-->
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
	 xmlns:s="library://ns.adobe.com/flex/spark" 
	 xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">
	<fx:Script>
		<![CDATA[
			public var _variableStatic : String = "Variable publique et statique";
			public var _variable : String = "Variable publique mais non statique";
			[Bindable]
			public var _variableStaticBindable : String = "Variable publique, statique et liable";
			[Bindable]
			public var _variableBindable : String = "Variable publique et liable mais non statique";
		]]>
	</fx:Script>
</s:Panel>
panelBeta.mxml (un autre Panel)
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
 
<?xml version="1.0" encoding="utf-8"?>
<!--
	panelBeta.mxml
-->
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
	 xmlns:s="library://ns.adobe.com/flex/spark" 
	 xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"
		 creationComplete="init()">
	<fx:Script>
		<![CDATA[
			public var _variable : String;
 
			private function init() : void {
				_variable = '';
			}
		]]>
	</fx:Script>
</s:Panel>
exemple.mxml (celui qui lance l'application)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
<?xml version="1.0" encoding="utf-8"?>
<!--
	exemple.mxml
-->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
		   xmlns:s="library://ns.adobe.com/flex/spark"
		   xmlns:mx="library://ns.adobe.com/flex/mx"
		   xmlns:panel="panel.*"
		   width="821" height="300" minWidth="955" minHeight="600">
	<panel:panelAlpha />
	<panel:panelBeta x="421" y="0"/>
</s:Application>
Tu peux donc remarquer que j'ai inséré mes deux panels dans mon composant principal.

Ma question est simple, comment et avec quelle variable de panelAlpha.mxml puis-je initialiser ma variable _variable dans panelBeta.mxml ?



Je te remercie d'avance