MovieClip 的宽度为负 1 亿 (-1.073741604E8) [英] Width of MovieClip is minus 100 million (-1.073741604E8)

查看:31
本文介绍了MovieClip 的宽度为负 1 亿 (-1.073741604E8)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序工作正常,但我有一个函数,它根据原始 MC 的宽度计算小地图,但是当宽度为负时它不起作用.所以问题基本上是,宽度怎么可能是负数?这是什么意思?谢谢

My application works fine, but I have a function, what calculates a minimap based on the width of the original MC, but it doesn't work when the width is negative. So the question is basically, how can width be negative? what does it mean? thanks

--抱歉,我不能发布任何代码,这是一个 30K LOC 项目.解决方案是将其包含在另一个影片剪辑中,这样效果会更好.

--edit: sorry, I can't post any code, it's a 30K LOC project. The solution was to include this in another movieClip, where it worked better.

推荐答案

我希望你测量的宽度的 MC 现在不在舞台上.我的 Sprite 对象遇到了同样的问题,如果它不在舞台上,则其宽度不可靠,而我尝试不要求宽度,而是要求 getBounds().尝试先将其添加到舞台,然后请求宽度.

I expect your MC which width you're measuring is not on stage right now. I'm experiencing the same issue with my Sprite object, if it's not on stage its width is unreliable, while I have tried not asking for width, but asking for getBounds() instead. Try first adding it to stage, then requesting width.

这篇关于MovieClip 的宽度为负 1 亿 (-1.073741604E8)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆