Bonjour à tous !

Je souhaite actuellement créer un menu en as3. Comme vous pouvez le voir dans le code suivant, j'ai réussi à mettre en place les listeners pour chaque boutons (yes!), et à animer un des boutons (dans la methode "TimerTestFunc"). Maintenant, je voudrais généraliser cet animation a n'importe quel bouton survolé ...

Comment faire ?!

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
public class Main extends MovieClip {
 
	public var interval:uint;  
	var TimerTest1:Timer = new Timer(10, 0);
 
	public function Main() {
 
	this.gotoAndStop(2);
 
	for (var i:int = 1; i<4; i++)
		{			Centre["btn"+i].addEventListener(MouseEvent.MOUSE_OVER, over);
		Centre["btn"+i].addEventListener(MouseEvent.MOUSE_OUT, out);
		}
	}				
 
	function over(pEvt:Event):void
	{
	TimerTest1.addEventListener(TimerEvent.TIMER,TimerTestFunc);
		TimerTest1.start();
	}
 
function out(pEvt:Event):void
	{	
		TimerTest1.stop();
		Centre.btn1.y = -31;
	}
 
	function TimerTestFunc(tEvt:Event):void
	{	
		Centre.btn1.y -= 1;
		if (Centre.btn1.y <-60){
			TimerTest1.stop();
		}
	}
}
Merci d'avance !