Have a look at this code:
<canvas width="100%" height="600" debug="true">
<class name="test1" extends="view">
</class>
<test1 x="100" y="100" width="100" height="100" bgcolor="#ff0000">
<handler name="onclick" args="p">
Debug.write(this);
Debug.write(parent);
</handler>
<handler name="onclick" reference="b1" args="p">
Debug.info("Event received by " + p);
Debug.write(this);
Debug.write(parent);
</handler>
</test1>
<button id="b1" text="Click me" />
</canvas>
When I click on the button, the onclick handler within test1 is called. But
"this" is an anonymous class extending test1. That's not very logical, is
it? I can imagine there was a good reason that you have to generate a
separate sprite object here, but it's very hard for programmers to
understand the underlying object structure. Is that the new way of dealing
with handlers?
Thanks,
Raju