Created
June 3, 2011 16:04
-
-
Save alecmce/1006588 to your computer and use it in GitHub Desktop.
Can I have my signal cake and eat it too?
This file contains 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
class NoCake | |
{ | |
private var _clicked:Signal; | |
private var _data:Object; | |
public function NoCake(mc:MovieClip, data:Object) | |
{ | |
_clicked = new Signal(Object); | |
_data = data; | |
mc.addEventListener(MouseEvent.CLICK, onClick); | |
} | |
private function onClick(event:MouseEvent):void | |
{ | |
_clicked.dispatch(data); | |
} | |
public function get clicked():ISignal | |
{ | |
return _clicked; | |
} | |
} | |
public class Cake | |
{ | |
private var _clicked:CakeSignal; | |
public function NoCake(mc:MovieClip, data:Object) | |
{ | |
_clicked = new CakeSignal(mc, MouseEvent.CLICK, _data); | |
} | |
public function get clicked():ISignal | |
{ | |
return _clicked; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment