ActionScript 3 比例缩放技术

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 比例缩放技术相关的知识,希望对你有一定的参考价值。

/* 

You can responds to any stage resize event by proportionally scaling the image to fill the stage. Since scaleX and scaleY are percentages, it's just a matter of figuring out which property is larger and making the two equal. By swapping the scale comparison from greater than to less than, the object will scale proportionally to fit the larger of the two dimensions given. This kind of calculation is handy when you need to fit items of variable dimensions into a fixed space.

*/

// set image dimensions to match stage or the object you want to scale to;
image.width = stage.stageWidth; // Or object.width
image.height = stage.stageHeight; // Or object.height

// choose the larger scale property and match the other to it;
( image.scaleX < image.scaleY ) ? image.scaleY = image.scaleX : image.scaleX = image.scaleY;

// choose the smaller scale property and match the other to it;
( image.scaleX > image.scaleY ) ? image.scaleY = image.scaleX : image.scaleX = image.scaleY;

以上是关于ActionScript 3 比例缩放技术的主要内容,如果未能解决你的问题,请参考以下文章

ActionScript 3 在Actionscript中绘制缩放对象

火狐浏览器怎样设置默认的页面缩放比例?

ActionScript 3 比例和约束

ActionScript 3 全屏图像调整大小(按比例)

ActionScript 3 AS3按比例调整大小

ActionScript 3 缩放文本以适合textField;缩放TextField以适合文本。