Hey guys,
I wrote a couple snippets for event-based programming in AS3:
-- addEventListener
addEventListener(${1:MouseEvent}.${2:CLICK}, ${3:on${2/(_)?([A-Z])([A- Z]+)/\u$2\L$3/g}}, ${4:false}, ${5:0}, ${6:true});
-- onEventType
${1:private} function on${2:Click}(event:${3:Event}${4: = null}): ${5:void} { $0 }
--
I realize that addEventListener is also available in autocomplete. Here's why you might use it anyway: - Chording two keys (opt-esc) for a function that is supposed to save you time (autocomplete) can feel clumsy. - The tab trigger will autofill a onEventType as a callback for EVENT_TYPE. - The above feature works well if you use escape to trigger naive autocompletion.
Thanks Simon for all your work on the AS3 bundle. Feel free to include these if you find them worthy. =) Brenton
I wrote a couple snippets for event-based programming in AS3: [...]
Thanks Brenton. I actually use something very similar in my personal bundle :) To avoid zombies I also regularly use a removeEventListener snippet:
event.currentTarget.removeEventListener(event.type, arguments.callee);
Cheers, Simon