1 Reply Latest reply on Oct 14, 2016 5:11 AM by Ned Murphy

    Drag and Drop from a specific hit spot of dragging object

    SSSSSSBenay Level 1

      Hello Friends,


      I have a simple movieclip, with an object moving from point A to point B. This movieclip is then placed on the canvas, and I have applied the following code to allow the user to drag and drop the movieclip (when the movieclip is clicked to drag, the animation stops), and for events to occur when the movie clip hits target areas:


      currentThought.addEventListener(MouseEvent.MOUSE_DOWN, dragThought);

        stage.addEventListener(MouseEvent.MOUSE_UP, dragThoughtStop);

        function dragThought(e:Event):void





        function dragThoughtStop(e:Event):void




        if (currentThought.hitTestObject(trashcan))






      The issue I am having is that I would like ONLY the object in the movieclip to be clickable, and at the moment, the path (invisible) of the object is also registering as part of the movieclip and it is clickable to drag. For example, if my object is a 10 px square, moving from coordinates x=0 to x=400, my "clickable" dragging hit area seems to be the entire 400px. When the 10px square is at x=300, I can click into empty space at x=50 and drag the movieclip. What I'd like to do, is make only the 10px square clickable.


      What do you suggest??


      Thank you in advance for your time!