[haXe] events

Nicolas Cannasse ncannasse at motion-twin.com
Mon Apr 3 13:07:23 CEST 2006


> How do I wire events in haXe, mainly in JS?

You can use local anonymous functions or direct binding :

button.onclick = function(evt) { .... };

or :

button.onclick = this.myClickHandler;

> Can I associate multiple functions to a single event?

Yes but not directly.
You can do the following :

var me = this;
button.onclick = function(evt) {
   me.action1(evt);
   me.action2(evt);
   ...
};

> Why are certain events in JS not declared (like onload)?

1) maybe they are not implemented in both IE and Firefox
2) maybe they are just missing

After testing that it works the same on both browsers, you're welcome to
submit declaration changes that will be part of next haXe distribution.

Nicolas



More information about the Haxe mailing list