Custom Event Class

package
{
import flash.events.Event;

public class MyCustomEvent extends Event
{
public static const MY_EVENT_FIRED:String = "MyEventFired";
public var data:*; //variable of * type to hold any kind of data object

public function ArrayFilledEvent(type:String)//, data:*)
{
//this.data = data;
super(type);
}
}
}

//Use this to dispatch this event in your main class
dispatchEvent(new MyCustomEvent(MyCustomEvent.MY_EVENT_FIRED));

//Use this to listen for this event in your main class
addEventListener(MyCustomEvent.MY_EVENT_FIRED, runThisFunction);

0 Comments

You must be logged in to post a comment.