what’s the difference between the following two type:
1.
var sprite:Test=new Test();
sprite.addEventListener(“EventType”,_onAction);
//…in the main class
private function _onAction(e:Event):void{
//use the event dispatched in the sprite object.
//get nothing,whether i changed these eventflow parameters anyway.why can’t receive the event???
}
2.
public class Test extends Sprite
{
public function Test(){
dispatchEvent(new Event(“EventType”));
addEventListener("EventType",_onAction);
}
private function _onAction(e:Event):void{
//the event is received.
}