본문 바로가기

AS

이벤트와 이벤트리스너 함수의 인자

var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoadComplete);
loader.load(new URLRequest("moonMap.png"));

... 중략

private function imageLoadComplete(event:Event):void
{
   textureMap = event.target.content.bitmapData;
... 하략
}


이벤트리스너를 LoaderInfo 객체가 설정했으므로 (위에 붉은색)
아래 이벤트 함수에서 event.target 은 LoaderInfo 객체로 볼 수 있게 되어
content 속성에 접근할 수 있게 된다.