View Full Version : drag and drop objects to grid
johosher
02-21-2008, 05:55 PM
how do i drag and drop a movieclip so that it snaps to a grid? i need it so that i can keep track of the other movieclips around it on the grid.
This positions it along a _y spacing:
var gridY = Math.Round((droppedMC._y-gridYoffset)/gridSpacing);
droppedMC._y=gridY*gridSpacing+gridYoffset;
You can do the same with _x
Then you add it to a 2D array, search for Paxcon in this forum for one suggestion on how to handle 2D arrays. Then you can use the entries in the array to get the ones beside it.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.