Simple custom event example actionscript 3.0

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:


PHP developer Cochin |PHP developer Kerala | PHP developer India | Flash developer/programmer Cochin | Flash developer/programmer Kerala | Flash developer/programmer India | web programmer kerala |web programmer Cochin |web programmer India |web developer kerala |Web developer Cochin | Kerala PHP | PHP freelancer| flash actionscript freelancer