---
title: "什么时候使用e.target.content和e.target as MovieClip?"
author: "china34420"
date: "2010-08-06T14:28:02Z"
tags: []
categories: ["编程语言"]
slug: "e-target-content-e-target-as-movieclip"
draft: false
lastmod: "2010-08-06T14:30:41Z"
id: 730924
url: "https://zpointer.iteye.com/blog/730924"
---

只是自己理解和使用习惯....
content : DisplayObject 
 包含使用 load() 或 loadBytes() 方法加载的 SWF 文件或图像（JPG、PNG 或 GIF）文件的根显示对象。

下以情况使用e.target.content:想得到由Loader加载的显示对像时
如

```java
var url:URLRequest=new URLRequest("路径")
var loader:Loader=new Loader;
loader.load(url);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
private function loadComplete(e:Event):void
		{
                   //此处可得到loader的引用:loader的显示对像
		   var  _tempMc:MovieClip = e.target.content;
		
		}
```


以下情况使用e.target as MovieClip:想得到监听对像的引用

```java
mc.addEventListener(MouseEvent.CLICK,clickHandler);
function clickHandler(e:MouseEvent){
    //此处可得到mc的引用
    var mc1:MovieClip=e.target as MovieClip;
}
```