开发者

resizing stage to fit photo

I want to create an application which loads pictures of diferent sizes like 720x800 1600x1000 2200x2000 and I want to show those pictures. Want I want is to load pictures with different sizes in a window which fits half my browser window(which i think can be done with javascript and html), and to load the whole quality of all pictures and not try to scale them down to fit them in a smaller w开发者_JAVA技巧indow. This means a browser on a bigger screen shows more pixels and the whole quality of bigger pictures. What I think I need is to scale movieclips but also the stage. The second I don't know how to do during execution.


You rarely want the stage to scale when you are writing an application for which you do not know the dimensions at author-time (and which hence requires a "liquid" layout.) When the stage scales, that scale needs to be accounted for in all transformations, unless you want all your content to scale too. Hence, what most people usually do is disable stage scaling altogether, and instead align the display list to the upper left corner of the embed window. This can be done using ActionSCript like so:

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

This should be all that you need to do to make your loaded images show up in their 1:1 size, regardless of the embed window's dimensions, and be cropped when the window is too small.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜