Created
February 27, 2014 02:05
-
-
Save tosik/9242886 to your computer and use it in GitHub Desktop.
as3signals で ActionScript3 の Event をやめよう ref: http://qiita.com/tosik/items/2c1596abf3d43077fe6e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var button:Button = new Button(); | |
| button.clicked.add(function():void { | |
| trace("The button clicked."); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Clicked extends Signal | |
| { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Button | |
| { | |
| public const clicked:Signal = new Signal; | |
| public function click():void | |
| { | |
| clicked.dispatch(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment