craigdsp
08-16-2005, 10:48 AM
i'm trying to write a little command that will move my selection to whole pixels.
i though originally that i would be able to write it so that i can select a bunch of things and have jsfl loop through them and move each one onto whole pixels. this failed miserablly so i'm now attempting to just get the selection moved onto a whole pixel which works with a 0.1% margin of error, which obviously dosen't work. grr it's winding me up.
dom = fl.getDocumentDOM();
rect = dom.getSelectionRect();
l = (Math.ceil(rect.left) - rect.left);
t = (Math.ceil(rect.top) - rect.top);
alert(l)
alert(t)
dom.moveSelectionBy({x:l, y:t});
i though originally that i would be able to write it so that i can select a bunch of things and have jsfl loop through them and move each one onto whole pixels. this failed miserablly so i'm now attempting to just get the selection moved onto a whole pixel which works with a 0.1% margin of error, which obviously dosen't work. grr it's winding me up.
dom = fl.getDocumentDOM();
rect = dom.getSelectionRect();
l = (Math.ceil(rect.left) - rect.left);
t = (Math.ceil(rect.top) - rect.top);
alert(l)
alert(t)
dom.moveSelectionBy({x:l, y:t});