2011-04-25 70 views
1

我在swapDepths函数中遇到了一些问题。我正在编写拖放系统。我创建了一个空的MovieClip(depthSwaper),其深度最高,每次拖动我的一个对象时,我都会用depthSwaper交换它的深度,所以我的对象始终处于最高深度。错误1006:Swapdepths不是函数

问题,我得到这个错误:“错误#1006:swapDepths不是一个函数”。

这里是我的脚本:

public function monDown(e:MouseEvent) { 
      e.currentTarget.icone.swapDepths(depthSwaper); 
      e.currentTarget.startDrag(); 
     } //monDown 

     public function monUp(e:MouseEvent) { 

      e.currentTarget.icone.swapDepths(depthSwaper); 
      e.currentTarget.stopDrag(); 
      if(e.currentTarget.hitTestObject(slotTete) && (e.currentTarget.type == "arme")) { 
       e.currentTarget.x = slotTete.x; 
       e.currentTarget.y = slotTete.y; 
      } else if(e.currentTarget.hitTestObject(slotTorse) && (e.currentTarget.type == "torse")) { 
       e.currentTarget.x = slotTorse.x; 
       e.currentTarget.y = slotTorse.y; 
      } else { 
       annulerDrag(e.currentTarget); 
      } 

     } //monUp 

currentTarget.icone是我移动的影片剪辑。我尝试使用只有一个数字的swapdepth,如下所示:e.currentTarget.icone.swapDepths(10); 但我收到了同样的错误。

有没有人有想法?

感谢您的阅读!

回答