[FLASH MX2004] [AS2] EventDispatcher
	
	
		Salut
je suis en train d'essayer de comprendre cette classe EventDispatcher
pour cela j'ai cree une extension de la classe Tween
	Code:
	
| 12
 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
 36
 37
 38
 39
 40
 41
 
 |  
class i_Effets.SuperTween extends Tween  {
 
	private static var __initEvent = EventDispatcher.initialize(SuperTween.prototype);
 
	private var dispatchEvent:Function;
	public var addEventListener:Function;
	public var removeEventListener:Function;
 
	//---Constructor
	public function SuperTween (obj:Object, prop:String, func:Function, begin:Number, finish:Number, duration:Number, useSeconds:Number)
	{
		super(obj, prop, func, begin, finish, duration, useSeconds);
	}
 
	//---- Private méthodes
	private function onMotionStarted(tw:Tween):Void {
		dispatchEvent({type:"onMotionStarted", target:tw});
	}
 
	private function onMotionLooped(tw:Tween):Void {
		dispatchEvent({type:"onMotionLooped", target:tw});
	}
 
	private function onMotionFinished(tw:Tween):Void {
		dispatchEvent({type:"onMotionFinished", target:tw});
	}
 
	private function onMotionChanged(tw:Tween, pos:Number):Void {
		dispatchEvent({type:"onMotionChanged", target:tw, position:pos});
	}
 
	private function onMotionStopped(tw:Tween):Void {
		dispatchEvent({type:"onMotionStopped", target:tw});
	}
 
	private function onMotionResumed(tw:Tween):Void {
		dispatchEvent({type:"onMotionResumed", target:tw});
	}
 
} | 
 je cree une autre classe
	Code:
	
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 
 |  
class i_Effets.Resize {
 
	//--- private
	private var ResizeEnd_x:Object=new Object();
 
	//---Construtor
	public function Resize(Void){}
	//---- Public méthodes
	public static function Redim (mc:MovieClip,speed:Number,w:Number,h:Number):Void
	{
		var twx:SuperTween = new SuperTween(mc, "_width", Back.easeOut, 100, 300, 32);
		twx.addEventListener("onMotionFinished",ResizeEnd_x);
	}
 
	private function ResizeEnd_x.onMotionFinished (e:Object):Void{
		}
 
} | 
 mais ca ne fonctionne pas
si je teste hors d'une classe 
	Code:
	
| 12
 3
 4
 5
 6
 
 |  
var ecouteur:Object = new Object ();
tw.addEventListener("ecouteur", listen);
ecouteur.onMotionFinished = function(e:Object) {
   trace("terminé");
} | 
 dans une animation ca fonctionne mais comment mettre ca dans une autre classe
merci