AS3 Revised Custom Event Class


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. package
  2. {
  3. import flash.events.Event;
  4.  
  5. /**
  6. * ...
  7. * @author Jeff Nehlsen
  8. */
  9. public class CustomEvent extends Event
  10. {
  11. // Event types.
  12. public static const EVENT_DEFAULT:String = "event1";
  13. public static const EVENT_CUSTOM:String = "event2";
  14.  
  15. public function CustomEvent(type:String = CustomEvent.EVENT_DEFAULT, bubbles:Boolean = false, cancelable:Boolean = false)
  16. {
  17. super(type, bubbles, cancelable);
  18. }
  19.  
  20. override public function clone():Event {
  21. // Return a new instance of this event with the same parameters.
  22. return new CustomEvent(type, bubbles, cancelable);
  23. }
  24. }
  25. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.