This is a simple custom Event example I hope this will help actionscript 3.0 bingers to understand how event works in actionscript 3.0. In this example I just created a MouseDown event listener for stage mouse clicks. Clicking the stage will trigger the custom event.
const CUSTOM_EVENT:String='custom_event';
addEventListener(MouseEvent.CLICK,onMouseClick);
function onMouseClick(e:Event){
dispatchEvent(new Event(CUSTOM_EVENT));
}
addEventListener(CUSTOM_EVENT,onCustomevent)
function onCustomevent(e:Event){
display.text="Custom Event Called"
}
0 comments:
Post a Comment