Voici un exemple de code que soulève mon pb :
Je chercherais a faire fonctionner hideButtonM2(), qui aurait le même but que hideButtonM1().
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 <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ private function hideButtonM1():void { id_bt.visible = false; } private function hideButtonM2(ca:String, cb:String, bt:String):void { ???.visible = false; } ]]> </mx:Script> <mx:Canvas x="449" y="23" width="301" height="121" id="id_ca"> <mx:ApplicationControlBar x="10" y="10" width="280" id="id_cb" height="101"> <mx:Button label="Hide Me" id="id_bt" width="263" height="76"/> </mx:ApplicationControlBar> </mx:Canvas> <mx:Button x="477.5" width="244" y="225" label="Hide - Button 02 - Directement" click="hideButtonM1()"/> <mx:Button x="477.5" width="244" y="264" label="Hide - Button 02 - Dynamiquement" click="hideButtonM2('id_ca', 'id_cb', 'id_bt')"/> </mx:Application>
En somme il me faudrait quelque chose (a la place du ???) comme :
getChildByName(ca).getChildByName(cb).getChildByName(bt).visible = false;
Voila,
Merci
Partager