从闪光中心缩放 [英] Scaling from the center in flash
本文介绍了从闪光中心缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用flash(AS3),并有一个动态影片剪辑,我想用滑块向上或向下缩放。我使用scaleX和scaleY函数可以很好地工作。
唯一的问题是,这些从文档的左边伸缩,我希望它是从中心缩放
任何帮助表示赞赏。
解决方案
函数scaleFromCenter(dis:*,sX:Number,sY:Number): void
{
var prevW:Number = dis.width;
var prevH:Number = dis.height;
dis.scaleX = sX;
dis.scaleY = sY;
dis.x + =(prevW - dis.width)/ 2;
dis.y + =(prevH - dis.height)/ 2;
}
scaleFromCenter(yourMovieClip,0.3,0.3);
..
在Greensocks TweenMax / AutoFitArea
http:// www。 greensock.com/autofitarea/
非常强大且易于使用。
I am using flash (AS3) and have a dynamic movie clip that I want to scale up or down using a slider bar. I have this working very well using the scaleX and scaleY functions.
The only trouble is that these scale from the left hand side of the document and I would like it to be scaled from the center
Any help is appreciated.
解决方案
function scaleFromCenter(dis:*, sX:Number, sY:Number):void
{
var prevW:Number = dis.width;
var prevH:Number = dis.height;
dis.scaleX = sX;
dis.scaleY = sY;
dis.x += (prevW - dis.width) / 2;
dis.y += (prevH - dis.height) / 2;
}
scaleFromCenter(yourMovieClip, 0.3, 0.3);
..
Or have a look at Greensocks TweenMax/AutoFitArea
http://www.greensock.com/autofitarea/
Very powerful and easy to use.
这篇关于从闪光中心缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文