PDA

View Full Version : Question on grid snapping.


rustyofco
08-16-2007, 10:43 PM
I have objects that are 32x32 in dimension (just a square), and my grid is also 32x32. I turn snapping to grid on.

The only problem is, and this is only due to inconvenience, is that I find I need to click in the VERY CORNER of my object in order to get it to snap upon moving. I am using the selection tool (arrow). If I don't click in a corner when I want to move it, it just won't snap to anything. If I click in the middle or in the middle of a edge, THAT part of the object will snap, which is not what I want. I just want that obj to fit into those boxes in the grid.

How do I get it to ALWAYS snap to that grid, no matter where I initially click the object? (the snap accuracy under edit grid doesnt fix this -- that does something else -- i have it set to always snap anyways)

matbury
08-19-2007, 04:03 AM
Hi rustyofco!

Interesting post. If you want to create an acurate grid, it's easier to do it in ActionScript. For example, a 10 x 10 grid would look like this:

var numOfSquares:Number = 100;
var spacing:Number = 32;
var posX:Number = 10;
var posY:Number = 10;

initGrid();

function initGrid():Void{
for(i:Number = 0; i < numOfSquares; i++){
var mc:MovieClip = this.attachMovie("square", "square" + i, this.getNextHighestDepth());
mc.num = i;
posX += spacing;
mc._y = posY;
mc._x = posX;
if(mc._x > 320){
posX = 10;
posY += 32;
}
}
};

Don't forget to export your "square" MovieClip for ActionScript or it won't work:

Library window > right-click your square MC > Linkage... > check "Export for ActionScript".