Question

I'm working on a image editor. If I need to export a jpeg with a specific size say 200X200 pixels, should I resize the entire movieclip (size of movieclip will be 200X200 but contents inside will of greater resolution) or resize contents directly in movieclip so that it resizes itself. Which is better way of programming to export jpegs? In simple words, should I pack contents inside a container and resize it as a whole or should I resize every single element while adding it to container?

Was it helpful?

Solution

Resizing (scaling) the entire movie clip is easier, but you will need to do that either uniformly without stretching, or stretch to fit so that the entire 200x200 area will be filled. I say go with resizing the container, because you will be sure that the contents of that container won't misalign while resizing.

var prevWidth:Number=container.width;
var prevHeight:Number=container.height;
var scX:Number=200/prevWidth;
var scY:Number=200/prevHeight; // stuff proper values instead of 200, if needed
if (scaleUniformly) scX=scY=Math.min(scX,scY);
// select minimum of upscales if scaling uniformly
container.scaleX=scX;
container.scaleY=scY;

PS: Usually questions of "which is better" are not welcome here at StackOverflow, because they occasionally provoke polemics, flame and rudeness.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top