{"id":950,"date":"2007-05-15T23:22:08","date_gmt":"2007-05-15T14:22:08","guid":{"rendered":"http:\/\/leavebehind.iobb.net\/wordpress\/archives\/950"},"modified":"2007-05-15T23:22:08","modified_gmt":"2007-05-15T14:22:08","slug":"custom-event-hundling","status":"publish","type":"post","link":"https:\/\/leavebehind.mydns.jp\/wordpress\/2007\/05\/15\/custom-event-hundling\/","title":{"rendered":"Custom event handling"},"content":{"rendered":"<p>\u30ad\u30ea\u30f3\u3068\u30ab\u30d0\u304c\u7121\u6027\u306b\u898b\u305f\u3044\uff01<br \/>\n\u304a\u4ed5\u4e8b\u3060\u3089\u3051\u3067\u4eba\u306b\u56f2\u307e\u308c\u30fc\u306e\u3001PC\u306b\u5411\u304b\u3044\u30fc\u306e\u306a\u72b6\u614b\u3067\u3044\u308b\u3068\u3064\u3044\u3064\u3044\u305d\u3093\u306a\u6c17\u5206\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3055\u3066\u3001\u4eca\u65e5\u306f\u3061\u3087\u3063\u3068ActionScript\u30ec\u30d9\u30eb\u30a2\u30c3\u30d7\u3057\u307e\u3057\u305f\u3002\u899a\u3048\u308b\u306e\u304c\u3081\u3093\u3069\u304f\u3055\u3044\u306e\u3067\u898b\u306c\u632f\u308a\u3092\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001<\/p>\n<p>\u3042\u308b\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068\u30e0\u30fc\u30d3\u30fc\u5185\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u4e00\u6589\u306b\u52d5\u304d\u51fa\u3059\u3068\u304b\u3001\u305d\u3093\u306a\u3053\u3068\u3092\u3084\u308a\u305f\u3044\u5834\u5408\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u914d\u5217\u3092\u3064\u304f\u308afor\u30eb\u30fc\u30d7\u3067\u3072\u3068\u3064\u305a\u3064\u306e\u95a2\u6570\u3092\u5b9f\u884c\u3059\u308b\u3063\u3066\u306e\u304c\u5730\u5473\u306a\u3084\u308a\u65b9\u3092\u3057\u3066\u307e\u3057\u305f\u304c\u3001\u3053\u308c\u3092\u3084\u3063\u3066\u308b\u3068\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u767a\u751f\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u306b\u3088\u3063\u3066\u306f\u305d\u306e\u914d\u5217\u304b\u3089\u6f0f\u308c\u305f\u308a\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\u3088\u3046\u3084\u304f\u3001\u30ab\u30b9\u30bf\u30e0\u30a4\u30d9\u30f3\u30c8\u767a\u884c\u306e\u4ed5\u7d44\u307f\u3092\u7406\u89e3\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u7c21\u5358\u306b\u8a00\u3046\u3068\u3042\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u81ea\u5206\u81ea\u8eab\u3092\u3060\u308c\u304b\u30a4\u30d9\u30f3\u30c8\u304c\u767a\u751f\u3059\u308b\u3068\u6559\u3048\u3066\u304f\u308c\u308b(\u30e2\u30fc\u30cb\u30f3\u30b0\u30b3\u30fc\u30eb\u3057\u3066\u304f\u308c\u308b\u4eba\u307f\u305f\u3044\u306a)\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u767b\u9332\u3057\u3066\u304a\u304d\u3001\u30a4\u30d9\u30f3\u30c8\u304c\u767a\u751f\u3059\u308b\u3068\u767b\u9332\u3057\u3066\u3042\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u5168\u3066\u3078\u901a\u77e5\u3059\u308b\u4ed5\u7d44\u307f\u3002(\u7c21\u5358\u3058\u3083\u306a\u3044\u306a)<\/p>\n<p><!--more--><br \/>\n\u307e\u305a\u306f\u3001\u30a4\u30d9\u30f3\u30c8\u767a\u884c\u3092\u3059\u308b\u30af\u30e9\u30b9\u3002<br \/>\nMyCustomEventTarget.as<\/p>\n<pre>import mx.events.EventDispatcher;\nclass MyCustomEventTarget {\n\tprivate var className:String = \"MyCustomEventTarget \";\n\tvar addEventListener:Function;\n\tvar removeEventListener:Function;\n\tprivate var dispatchEvent:Function;\n\tfunction MyCustomEventTarget () {\n\t\tEventDispatcher.initialize(this);\n\t}\n\tfunction toString():String {\n\t\treturn className;\n\t}\n\tfunction dispatchFunctionA():Void {\n\t\tdispatchEvent({type:\"functionA\"});\n\t}\n}<\/pre>\n<p>\u3067\u3082\u3063\u3066\u30a4\u30d9\u30f3\u30c8\u767b\u9332\u3068\u53d7\u3051\u53d6\u308a\u5f8c\u306e\u5b9f\u884c\u3092\u3059\u308b\u30af\u30e9\u30b9\u3002<br \/>\nMyEventListener.as<\/p>\n<pre>class MyEventListener{\n\tfunction MyEventListener(eventTarget:Object){\n\t\teventTarget.addListener(\"functionA\",this);\n\t}\n\tfunction functionA(){\n\t\ttrace(\"execute!\")\n\t}\n}<\/pre>\n<p>\u30d5\u30ec\u30fc\u30e0\u30a2\u30af\u30b7\u30e7\u30f3<\/p>\n<pre>var target:MyCustomEventTarget = new MyCustomEventTarget();\n\nvar myObjA:MyEventListener = new MyEventListener(target);\nvar myObjB:MyEventListener = new MyEventListener(target);\nvar myObjC:MyEventListener = new MyEventListener(target);\n.\n.\n.\n<\/pre>\n<p>\u3063\u3066\u611f\u3058\u3067\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u3063\u3066\u3057\u307e\u3048\u3070\u3001\u597d\u304d\u306a\u30bf\u30a4\u30df\u30f3\u30b0\u3067<\/p>\n<pre>target.dispatchFunctionA<\/pre>\n<p>\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u3001myObjA,B,C&#8230;\u306efunctionA\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30ad\u30ea\u30f3\u3068\u30ab\u30d0\u304c\u7121\u6027\u306b\u898b\u305f\u3044\uff01 \u304a\u4ed5\u4e8b\u3060\u3089\u3051\u3067\u4eba\u306b\u56f2\u307e\u308c\u30fc\u306e\u3001PC\u306b\u5411\u304b\u3044\u30fc\u306e\u306a\u72b6\u614b\u3067\u3044\u308b\u3068\u3064\u3044\u3064\u3044\u305d\u3093\u306a\u6c17\u5206\u306b\u306a\u308a\u307e\u3059\u3002 \u3055\u3066\u3001\u4eca\u65e5\u306f\u3061\u3087\u3063\u3068ActionScript\u30ec\u30d9\u30eb\u30a2\u30c3\u30d7\u3057\u307e\u3057\u305f\u3002\u899a\u3048\u308b\u306e\u304c\u3081\u3093\u3069\u304f\u3055\u3044\u306e\u3067\u898b\u306c\u632f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2],"tags":[34,45,117],"class_list":["post-950","post","type-post","status-publish","format-standard","hentry","category-actionscript","tag-actionscript","tag-as2","tag-flash"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p8YSE4-fk","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/posts\/950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/comments?post=950"}],"version-history":[{"count":0,"href":"https:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/posts\/950\/revisions"}],"wp:attachment":[{"href":"https:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/media?parent=950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/categories?post=950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/tags?post=950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}