/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Snap object depending on the snapToSize // Can be used for window dragging or in games etc. // if the side of my square in my grid is 250, the snapToSize parameter would be 250. // If it is 100, the snapToSize parameter would be 100. var snapToSize:int = 5; snapClip_mc.x = mouseX - mouseX % snapToSize; snapClip_mc.y = mouseY - mouseY % snapToSize;