我想知道这两个 dispatchEvent 方法之间的区别......
//1.
eventObj:YouTubeSearchEvent = new YouTubeSearchEvent(YouTubeSearchEvent.CHANGE_VIDEO_READY);
eventObj.videoId = theOneVideoId;
dispatchEvent(event);
//2
dispatchEvent(new YouTubeSearchEvent(YouTubeSearchEvent.CHANGE_VIDEO_READY, videoId));
根据我的自定义事件,我需要有两个参数......但想知道第一种方法是否与第二种方法不同......
我的自定义事件:
package com.search.events
{
import flash.events.Event;
public class YouTubeSearchEvent extends Event
{
public static const FEED_VIDEO_READY:String="feed_video_ready";
public static const CHANGE_VIDEO_READY:String="change_video_ready";
public var videoResult:*;
public function YouTubeSearchEvent(type:String, videoResult:*)
{
super(type);
this.videoResult=videoResult;
}
}
}
问题来自我的另一篇文章 AS3 Pass Custom Event Data Question