# Why Matrix does this?

**URL:** https://forum.kirupa.com/t/why-matrix-does-this/330283
**Category:** flash
**Created:** [December 25, 2012, 2:04am UTC](https://forum.kirupa.com/t/why-matrix-does-this/330283 "2012-12-25T02:04:05Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![na\_il](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@na\_il](https://forum.kirupa.com/u/na_il)
#### Post date: [December 25, 2012, 2:04am UTC](https://forum.kirupa.com/t/why-matrix-does-this/330283/1 "2012-12-25T02:04:05Z")

</div>

I want to be able to drag and drop the movieclip and dynamically skew based on the mouse position but. When I click the movie clip it jumps to top left corner, and I can’t drag and drop the mc… Why is this?

```auto

import flash.geom.Matrix;
import flash.events.MouseEvent;
import flash.sampler.NewObjectSample;

//shadow matrix 

circ.addEventListener(MouseEvent.MOUSE_DOWN, drag)
circ.addEventListener(MouseEvent.MOUSE_UP, drop)

function drop(event:MouseEvent):void{
	circ.stopDrag();
	stage.removeEventListener(Event.ENTER_FRAME, skewer)
}

function drag(event:MouseEvent):void{
	circ.startDrag();
	stage.addEventListener(Event.ENTER_FRAME, skewer)
	 //circ.transform.matrix = sm;
}

function skewer(e:Event):void{
	
	circ.scaleX = 1 + Math.abs((550 - mouseX)/550);
	var sm:Matrix = new Matrix();
	
	//a = x scale / b = y skew / c = x skew / d = y scale / tx = x translation ty = y	
	sm.b = 1 + Math.abs((550 - mouseX)/550);
	circ.transform.matrix = sm;
	    	
}

```

Thanks
