问题
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
--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.
回答1:
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.
回答2:
I don't know your code. but i'm afraid overflow occur. MovieClip property width value is Number.
Numer of the range are as follows:
4.9406564584124654e-324 <= Number <=1.79769313486231e+308
if you've initialized a positive number to width, somewhere in the code will be occur overflow.
来源:https://stackoverflow.com/questions/11824850/width-of-movieclip-is-minus-100-million-1-073741604e8