Guest User

Untitled

a guest
Jan 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. /// clickType declared elsewhere in code.
  2. checkBoxFast.addEventListener(clickType, goFast("yes"));
  3.  
  4. function goFast(evt:Event=null,myVar:String)
  5. {
  6. trace(myVar);
  7. }
  8.  
  9. checkBoxFast.addEventListener(clickType, function(e:Event):void{goFast("yes")});
  10.  
  11. function goFast(myVar:String)
  12. {
  13. trace(myVar);
  14. }
  15.  
  16. public class MyEvent extends Event {
  17. public var myVar:String;
  18.  
  19. public function MyEventHistoryEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) {
  20. super(type, bubbles, cancelable);
  21. }
  22. }
  23.  
  24. var event:MyEvent = new MyEvent("eventType");
  25. event.myVar = "yes";
  26.  
  27. dispatchEvent(event);
  28.  
  29. checkBoxFast.addEventListener("eventType", eventHandler);
  30.  
  31. protected function eventHandler(event:MyEvent):void {
  32. trace(event.myVar);
  33. }
  34.  
  35. public function test() {
  36.  
  37. var myVar : String = "some value";
  38. addEventListener(MouseEvent.CLICK, onClick);
  39.  
  40.  
  41. function(e:Event){
  42. trace(myVar);
  43. }
  44.  
  45. }
Add Comment
Please, Sign In to add comment