Return to Snippet

Revision: 32390
at September 23, 2010 12:35 by jknight42


Initial Code
var curr_doc = fl.getDocumentDOM();

for(i=0 ; i<curr_doc.selection.length ; i++ ) {
	curr_doc.selection[i].x = Math.round(curr_doc.selection[i].x);
	curr_doc.selection[i].y = Math.round(curr_doc.selection[i].y);
	
}

Initial URL
http://www.cannedbanners.com

Initial Description
This code is pretty simple but massively useful. You can select any number of elements on the stage in Flash, then run this JSFL Command and it will round their x and y values to the nearest whole number. It's very handy when you want things to be on the whole pixel to prevent blurring or other wierdness.

Initial Title
JSFL: Round the x and y values of any selected objects

Initial Tags
flash

Initial Language
JavaScript