Prev | Current Page 633 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

events
.IEventDispatcher interface. The flash.events.EventDispatcher class is a base class that
implements the IEventDispatcher interface and that can be extended to provide the events features.
The IEventDispatcher interface defines methods that provide a fine control over events. It is possible
to register more than one handler for each event with addEventListener() , it is possible to remove
them using removeEventListener() , to check if an event is associated with a specific handler with
hasEventListener() , or to invoke the handlers associated to the event with dispatchEvent() .
Differently from previous versions, there are no object fields associated to the events and they are
referenced using a string identifier.
import flash.Lib;
import flash.display.MovieClip;
import flash.events.MouseEvent;
class Main
{
public static function main()
{
var mc = createMovieClip();
drawRect(mc, 150, 10, 50, 50);
mc.addEventListener(MouseEvent.CLICK, function(event)
{
trace(???Clicked!???);
});
mc.addEventListener(MouseEvent.


Pages:
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645