简体   繁体   English

如果舞台缩放,AS3 获取影片剪辑的确切大小

[英]AS3 Get exact size of movieclip if stage scaled

How do I get an exact width and height of a MovieClip if it was scaled on stage resize?如果在舞台调整大小时缩放了 MovieClip,我如何获得准确的宽度和高度?

for example if I have:例如,如果我有:

stage.scaleMode=StageScaleMode.EXACT_FIT;

stage.addEventListener(MouseEvent.MOUSE_DOWN, checkSize);
function checkSize(e:MouseEvent):void{
    trace(mc.width);
}

It will always output the same width and height no matter how big or small the stage is.无论舞台有多大或多小,它都将始终保持相同的宽度和高度。 Is there anyway to get exact current size?反正有没有得到确切的当前大小?

Thank you.谢谢你。

The current size of your MovieClip is as shown by your trace() I don't think there's a way to determine (easily) how many pixels down and across your MovieClip is with EXACT_FIT enabled.您的 MovieClip 的当前大小如您的trace()所示我认为没有办法(轻松地)确定启用EXACT_FIT的 MovieClip 向下和跨过多少像素。

Try using either mc.measuredWidth, or mc.width * mc.scaleX?= 1. mc:scaleX;scaleX;尝试使用 mc.measuredWidth 或 mc.width * mc.scaleX?= 1。 mc:scaleX;scaleX;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM