Event
出自OpenFace
==<event>== (event的例子好像不是这样写的)
[zuojh: EFC中不再需要使用event标签声明事件,可以直接用handler标签引用事件]
Declare an event on the object that contains it.
The <event> tag declares that the containing object can generate the event named name. Note that the name of the event must not begin witn an underscore.
In a class definition, the <event> tag defines an event that can be sent from instances of the class.
<class name="myclass_with_handler">
<event name="myevent"/>
<handler name="myevent" args="myargs">
Debug.write(this, 'handling myevent, myargs=', myargs);
</handler>
</class>
In LZX, events are generated automatically by the setAttribute method. When you call obj.setAttribute('attrname', val), an event named with the prefix "on" and name of an the attribute is sent, in this case the event called would be named onattrname and a single arg value of val would be passed.
<class name="myclass_with_handler">
<event name="myevent"/>
<attribute name="blah" value="259"/>
<event name="onblah"/>
<handler name="onblah" args="val">
Debug.write(this, 'handler for onblah', val);
</handler>
</class>
See the Guide for a complete discussion.
Also see the documentation for <handler>.
Attributes
Name Usage Type (Tag) Type (JS) Default Category
name Tag only token final
The name of a variable that will be set to this object when the application is started. If this element is directly within a <canvas> or <library> element, the global variable and the canvas property with this name will be set to this object. If this element is within another object, that object's property with this name will be set to this object.

