as3 中精灵的最大尺寸? [英] maximum size of a sprite in as3?
本文介绍了as3 中精灵的最大尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
as3/flash 10 中精灵的大小有上限吗?
Is there an upper bound to the size of a sprite in as3 / flash 10?
我知道bitmapData 有局限性...
推荐答案
看来,xScale 和 yScale 不能超过 0x8000 ...
it seems, that xScale and yScale may not exceed 0x8000 ...
大小本身似乎也受到限制...我发现了一个限制 0x6666660...
size itself also seems to be bound ... i found a limit 0x6666660 ...
这里是代码:
package {
import flash.display.*;
public class Main extends Sprite {
public function Main():void {
var size:Number = 1;
var s:Shape = new Shape();
s.graphics.beginFill(0xFF00FF);
s.graphics.drawRect(0, 0, size, size);
var old:Number = 0;
while (s.width > old) {
old = s.scaleX;
s.scaleX *= 1.1;
}
trace(s.width.toString(16));
size = 1;
s.scaleX = 1;
while (true) {
size *= 2;
s.graphics.clear();
s.graphics.drawRect(0, 0, size, size);
if (s.width < 0) break;
}
var min:Number = size / 2;
var max:Number = size;
while (true) {
size = (min + max) / 2;
s.graphics.clear();
s.graphics.drawRect(0, 0, size, size);
if (s.width < 0) max = size;
else
if (max - min < 1) break;
else min = size;
}
trace(s.width.toString(16));
}
}
}
没有找到任何关于它的文档......所以你甚至可能在你的机器上得到其他结果......
didn't find any documentation about it ... so you may even get other results on your machine ...
问候
back2dos
这篇关于as3 中精灵的最大尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文