height="100%" layout="vertical">
import mx.controls.Alert;
[Bindable]
public var labelText:String = "Label before event";
public function clickFunction(event:Event):void
{
var message:String = "you clicked me! " + event.target.label;
Alert.show(message,"Event Test");
}
public function addMyEvent():void
{
if (myButton.hasEventListener(MouseEvent.MOUSE_OVER)) {
myButton.removeEventListener(MouseEvent.MOUSE_OVER,changeLabel);
myInput.text = "Event was Removed";
addEventButton.label ="Click this button to add event";
myLabel.text = "Mouse over Event listener removed";
} else {
myButton.addEventListener(MouseEvent.MOUSE_OVER,changeLabel);
myInput.text = "Event was added";
addEventButton.label ="Click this button to remove event";
}
}
public function changeLabel(event:MouseEvent):void
{
myLabel.text = "Mouse over";
}