Skip to content

Instantly share code, notes, and snippets.

@tosik
Created February 27, 2014 02:05
Show Gist options
  • Select an option

  • Save tosik/9242886 to your computer and use it in GitHub Desktop.

Select an option

Save tosik/9242886 to your computer and use it in GitHub Desktop.
as3signals で ActionScript3 の Event をやめよう ref: http://qiita.com/tosik/items/2c1596abf3d43077fe6e
var button:Button = new Button();
button.clicked.add(function():void {
trace("The button clicked.");
});
public class ButtonEvent extends Event
{
public static const CLICKED:String = 'CLICKED';
public function RestartEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
{
super(type, bubbles, cancelable);
}
}
public class Clicked extends Signal
{
}
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