2013-07-28 30 views
0

类型错误: - 错误#2007当我测试这似乎电影参数hitTestObject必须为非空

类型错误:错误#2007:萨尔瓦多勇气德尔parámetrohitTestObject德贝SER distinto德空。

at flash.display::DisplayObject/_hitTest() 
at flash.display::DisplayObject/hitTestObject() 
at DragDrop/drop() 

这里的的DragDrop代码:

package 
{ 
    import flash.display.*; 
    import flash.events.*; 


    public class DragDrop extends Sprite 
    { 
     var origX:Number; 
     var origY:Number; 
     var target:DisplayObject; 

     public function DragDrop() 
     { 
      origX = x; 
      origY = y; 

      addEventListener(MouseEvent.MOUSE_DOWN, drag); 
      buttonMode = true; 

     } 

     function drag(evt:MouseEvent):void 
     { 
      stage.addEventListener(MouseEvent.MOUSE_UP, drop); 
      startDrag(); 
      parent.addChild(this); 
     } 

     function drop(evt:MouseEvent):void 
     { 
      stage.removeEventListener(MouseEvent.MOUSE_UP, drop); 
      stopDrag(); 

      if(hitTestObject(target)) 
      { 
       visible = false; 
       target.alpha = 50; 
       Object(parent).match(); 
      } 

      x = origX; 
      y = origY; 

     } 

    } 

} 

请我需要你的帮助。

在这里,您可能需要的所有assides。 http://www.mediafire.com/?t1b1u2ipbpj1a8t

+0

你在哪里指定'target'?你反对不知道它的“目标”,直到你给它的目标。不,它不会在另一个类的变量中查找目标。 – Vesper

回答

0

问题是您的target对象从未被设置!你需要定义目标!

+0

我该如何进行去色?请帮帮我 – Manuel

相关问题