0
votes

When I'm testing the movie this appears:

TypeError: Error #2007: El valor del parámetro hitTestObject debe ser distinto de null.

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

Here's the DragDrop Code:

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;

        }

    }

}

Please I need your help.

Here the all asstes that you may need. http://www.mediafire.com/?t1b1u2ipbpj1a8t

1
Where do you assign target? You object does not know about its target until you give it that target. And no, it won't look up target in another class's variables.Vesper

1 Answers

0
votes

The problem is that your target Object is never being set! You need to define target!