dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Dispatch Events in AS2.0

  1. #1
    Junior Member
    Join Date
    Nov 2019
    Posts
    1

    Dispatch Events in AS2.0

    function onComponentClickHandler( o:Object ):Void{
    trace(“component clicked”);
    //do something here
    }
    component.addEventListener(“click”, onComponentClickHandler);

    //component class – Component.as
    import mx.events.EventDispatcher;
    class com.Component extends MovieClip
    {
    public var addEventListener:Function; //declaring the function to access addEventListener of MovieClip

    public function Component () {
    EventDispatcher.initialize(this);
    this.onRelease = function() {
    //creating the event object
    var eventObj:Object = new Object();
    eventObj.type = “click”; // event type
    eventObj.target = this; // event target
    dispatchEvent(eventObj);
    }
    }
    }

  2. #2
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,808
    Is there a question here? Also, you can use a [CODE] wrap to help with posting code. If you want an example then the quote button should help.
    .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center