ianharrigan/haxeui — pull request #24 by profelis (2013-10-27 16:40:43+00:00)
Title: UIEvent

experimental request, but I use this in my project.

UIEvent.displayObject contains real IDisplayObject.

Now in handler I can't read real currentTarget, only sprite. And usualy you use
```
for (i in 1...btns.length)
btns[i].addEventListener(MouseEvent.CLICK, function (_) onButtonClick(i));

function onButtonClick(index:Int) {
var btn = btns[index];
}
```

but with UIEvent you can write
```
for (button in btns)
button.addEventListener(MouseEvent.CLICK, onButtonClick);

function onButtonClick(e:UIEvent) {
var btn:Button = cast e.displayObject; // e.displayObject - currentTarget
}
```