self-customized EventDispatcher (as3)
[ 2009-06-20 00:47:41 | Author: liuhuan ]
To build a self-customized eventdispatcher in actionscript 3:
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
public class MyEventDispatcher extends Sprite {
public function MyEventDispatcher() {
addEventListener("OPEN222", handleOpenEvent);
dispatchEvent(new Event("OPEN222"));
}
private function handleOpenEvent(event:Event) {
txt.text = "OPEN";
}
}
}
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
public class MyEventDispatcher extends Sprite {
public function MyEventDispatcher() {
addEventListener("OPEN222", handleOpenEvent);
dispatchEvent(new Event("OPEN222"));
}
private function handleOpenEvent(event:Event) {
txt.text = "OPEN";
}
}
}
Comments Feed: http://www.liuhuan.com/blog/feed.asp?q=comment&id=989
There is no comment on this article.
You can't post comment on this article.