# Drag and scratch

**URL:** <https://forum.kirupa.com/t/drag-and-scratch/185912>\
**Category:** Uncategorized\
**Created:** [April 17, 2006, 5:09pm UTC](https://forum.kirupa.com/t/drag-and-scratch/185912 "2006-04-17T17:09:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rawnewdlz](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@rawnewdlz](https://forum.kirupa.com/u/rawnewdlz)\
**Post date:** [April 17, 2006, 5:09pm UTC](https://forum.kirupa.com/t/drag-and-scratch/185912/1 "2006-04-17T17:09:22Z")

</div>

Hi, I’d like to add a click and drag function where I have a coin that scratches off a mask (like a lotto ticket)  
Where would I add the Drag?  
This is the AS on the masked clip it works but needs repeated clicking

```auto

onClipEvent(load)
{
        _root.createEmptyMovieClip('scratch',0);
        function drawScratch()
        {
                x = _root._xmouse;
                y = _root._ymouse;
                with(_root.scratch)
                {
                       // clear(); <!--scratches aren't erased, adding to the clip and creating a bigger mask!
                        moveTo(x-50,y-50);
                        beginFill(0x000000)
                        lineTo(x+10,y-10);
                        lineTo(x+10,y+10);
                        lineTo(x-10,y+10);
                        endFill(); // change 10's to 50 for square
                }
        }
        this.setMask (_root.scratch)
}
onClipEvent(mouseMove) //mouseDown= has to be clicked everytime
{
        drawScratch();
        updateAfterEvent();
}

```
