# TypeError: Error #1034: Type Coercion failed

**URL:** <https://forum.kirupa.com/t/typeerror-error-1034-type-coercion-failed/318017>\
**Category:** Uncategorized\
**Created:** [January 8, 2011, 8:24am UTC](https://forum.kirupa.com/t/typeerror-error-1034-type-coercion-failed/318017 "2011-01-08T08:24:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asteroids](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@Asteroids](https://forum.kirupa.com/u/Asteroids)\
**Post date:** [January 8, 2011, 8:24am UTC](https://forum.kirupa.com/t/typeerror-error-1034-type-coercion-failed/318017/1 "2011-01-08T08:24:29Z")

</div>

hi …

this is my drag and drop code

when i press ctrl+enter

output panel show

[COLOR=red]TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::Event@3196fe71 to flash.events.MouseEvent.[/COLOR]

```php
contents.mask = mcMask;
var target:MovieClip;
var Drags:Boolean;
contents.addEventListener(MouseEvent.MOUSE_DOWN,mDown);
//content.Area.addEventListener(MouseEvent.MOUSE_DOWN,mUp);
function mDown(e:MouseEvent)
{
 contents.pressX = mouseX;
 contents.addEventListener(MouseEvent.MOUSE_MOVE, checkAxis);
}
function checkAxis(e:MouseEvent)
{
 var dx:Number = Math.abs(mouseX-contents.pressX);
 if(dx)
 {
  contents.addEventListener(Event.ENTER_FRAME,catchX);
 }
 contents.removeEventListener(MouseEvent.MOUSE_MOVE, checkAxis);
}
function catchX(e:MouseEvent)
{
 target = contents;
 contents.removeEventListener(Event.ENTER_FRAME,catchX);
 target.oldX = target.x;
 var left = mcMask.x+(mcMask.width-target.width);
    var right = mcMask.x;
 Drags = true;
 target.addEventListener(Event.ENTER_FRAME, findDeltaX);
 target.addEventListener(MouseEvent.MOUSE_UP, throwX);
}
 
function throwX(e:MouseEvent)
{
    Drags = false;
 var targetX:Number = mcMask.x+(Math.round((target.x + target.deltaX)/mcMask.width))*mcMask.width;
 target.deltaX = (targetX - target.x)%mcMask.width; 
 //target.onEnterFrame = landingX;
 target.addEventListener(Event.ENTER_FRAME, landingX);
 target.removeEventListener(MouseEvent.MOUSE_UP, throwX);
 //delete target.onReleaseOutside;
}
function findDeltaX(e:MouseEvent)
{
    contents.deltaX = (mouseX - contents.oldMouseX)*10;
 contents.oldMouseX = mouseX;
trace(this.deltaX);
}
function landingX(e:MouseEvent)
{
    if(Math.abs(contents.deltaX * 0.8) > 0.1)
    {
        contents.x+=this.deltaX*0.2;
        contents.deltaX*=0.8;
    }
    else
 {
  contents.oldX = contents.x;
  target.removeEventListener(Event.ENTER_FRAME, landingX);
 }
}

```

plz help me

Thanks a million in advance . 🙂
