Copy link to clipboard
Copied
Looking for a way to code, "When Dragged On Image, Push, Pull, Stretch pixels.
I want to be able to distort images I publish by Click & Dragging and via Mouse Wheel. Would be ideal if: Drag to stretch, and mouse wheel to scale images.
Signed: Clueless
Copy link to clipboard
Copied
Hi Tom,
I'm not sure if this would do it for you, and I don't know how to use the mouse wheel as a programmatic input device -- never done that before.
But, I'd make the image as a MovieClip (MC): call it mainImage. I'd make another graphic object as MC that acts a "dragging handle,": call it draggingHandle.
I'd put draggingHandle on top of the edge of mainImage.
This code should work:
var mainImageOrigWidth = mainImage.width;
draggingHandle.addEventListener(MouseEvent.MOUSE_DOWN,startDragging);
draggingHandle.addEventListener(MouseEvent.MOUSE_UP,stopDragging);
function startDragging(e:MouseEvent):void{
draggingHandle.startDrag();
}
function stopDragging(e:MouseEvent):void{
mainImage.scaleX = (draggingHandle.x - mainImage.x) / mainImage.width;
draggingHandle.stopDrag();
}