Ver Mensaje Individual
  #2 (permalink)  
Antiguo 06/07/2006, 17:14
Avatar de TMeister
TMeister
Crazy Coder
 
Fecha de Ingreso: enero-2002
Ubicación: En la Oficina
Mensajes: 2.880
Antigüedad: 22 años, 3 meses
Puntos: 193
si se puede pero tienes que implementarlo en tu clase. por ejemplo

Clase button

Código:
import mx.events.EventDispatcher
 [Event("onClick")]
 [Event("onOver")]
 [Event("onOut")]
class button extends MovieClip
{
	function button ()
	{
		EventDispatcher.initialize (this);
		init ();
	}
	private function init ()
	{
		this.onRelease = function ()
		{
			this.dispatchEvent ( 
			{
				type : "onClick", param1 : "parametro1"
			})
		}
		this.onRollOver = function ()
		{
			this.dispatchEvent ( 
			{
				type : "onOver", param1 : "parametro1"
			})
		}
		this.onRollOut = function ()
		{
			this.dispatchEvent ( 
			{
				type : "onOut", param1 : "parametro1"
			})
		}
	}
}
En tu Fla debes tener un MovieClip que sera tu boton asignandole la clase button y el codigo para asignarle el EventListener es:

Código:
mi_btn.addEventListener("onClick", Event);
mi_btn.addEventListener("onOver", Event);
mi_btn.addEventListener("onOut", Event);
function Event(obj:Object) {
	for (var a in obj) {
		trace("key: "+a+" value: "+obj[a]);
	}
}
Obviamente el nombre de instancia del clip es mi_btn