tags:

views:

167

answers:

1

So I'm trying to use guides on my flash stage to better align objects, but how do I get the guides to snap to pixels? Half the time they end up being 298.4 etc, when I want them nicely snapped on each pixel, so 298.0.

I'm using Flash CS3, and I have all the snapping options turned on. I read somewhere that holding down shift will snap guides to pixels, but this doesnt seem to work. Any ideas?

Surely this must be possible?

Thanks,

Chris.

+1  A: 

Hi,

Some guys might not consider this question relevant to stackoverflow since it's not related to programming, or it's a pretty easy one. It can get geeky though :)

Anyway, If you go to Edit Snapping ( CMD + / (MAC ) or Ctrl + / (PC) ) and set:

  1. Snap Align
  2. Snap to Guides
  3. Snap to Pixels

turned on and also, turn the Grid on ( right click an empty space in the document and go to Grid > Show Grid ). You might want to edit the grid to be 1 x 1 instead of the default 18 x 18 pixels.

If you don't turn the grid on, you might get snapping to half pixel (.5 ) values, which I'm assuming you want to avoid.

Let me know if you plan to do some pixel art, I can recommend some handy tools, otherwise if it's just having a crisp layout you're setup, this extension would've been handy, but the link doesn't work unfortunately.

Fortunately it's a pretty easy thing to write. I just made a new JSFL Document ( RoundPixelValues.jsfl for example ) and saved it in the $Flash/Commands folder, where Flash is your application/program files folder.

You can write the whole thing in 3,4 lines of code probably, but I've spead it out on 10 for readability:

var doc = fl.getDocumentDOM();
var timeline = doc.getTimeline();
var currentLayer = timeline.layers[timeline.currentLayer];
var currentFrame = currentLayer.frames[timeline.currentFrame];
var elements = currentFrame.elements; 
var elementsNum = elements.length;
for(var i = 0 ; i < elementsNum ; i++){
    elements[i].x = Math.round(elements[i].x);
    elements[i].y = Math.round(elements[i].y);
}

just paste the code in the newly created jsfl file and save. The option should come up in your Commands Menu. The advantage is that you can also setup a keyboard shortcut if you need this often enough.

Goodluck !

George Profenza