Item snaps to partial-pixel location with "Snap to Pixels" on
Issue
When drawing items in Macromedia Flash with View > Snapping> Snap to Pixels on, the object may not precisely align to even pixels. For example, the X and Y of a dynamic textfield might be 10.5 or 84.3 instead of an even amount.
Reason
If Snap to Pixels is on, a pixel grid appears when the view magnification is set to 400% or higher. The pixel grid represents the individual pixels that will appear in your Flash application. When you create or move an object, it is constrained to the pixel grid.
However, there are two possible ways for Snap to Pixels to cause this behavior:
- When drawing objects with strokes, the center of the stroke snaps to the pixel. The actual width of the stroke is split on both side of the center. So when the X and Y values are viewed in the Properties Inspector, they show the location of the edge of the stroke. So a box or line with a stroke value of 1, when placed on horizontal pixel 90, may show an X of 89.5.
This is the expected behavior for objects with strokes, but is often misunderstood.
- If the object does not contain a stroke, then it is still possible for it to misalign to an uneven pixel value. This is especially true of Text Fields, which may fall on uneven pixel values, especially on the Y axis.
Unfortunately this is a known issue with both Flash MX 2004 and Flash 8.
Ref. (138404)
Solution
If this occurs in your work, it will be necessary to do one of two things:
- Turn View > Snapping > Snap to Pixels off and manually adjust the location of the object.
- Select the object and enter the even pixel value in the X or Y field of the Properties Inspector.
Additional Information
Adjusting objects to even pixels is especially relevant for mobile developers. In mobile content, objects that are not on even pixels will often display blurry, with lower quality than objects on even pixels.
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
