开发者

AS3 Get exact size of movieclip if stage scaled

开发者 https://www.devze.com 2023-03-11 20:17 出处:网络
How do I get 开发者_运维知识库an exact width and height of a MovieClip if it was scaled on stage resize?

How do I get 开发者_运维知识库an exact width and height of a MovieClip if it was scaled on stage resize?

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.


Try using either mc.measuredWidth, or mc.width * mc.scaleX != 1? mc.scaleX:scaleX;

0

精彩评论

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