AS3/FP9 - 调整精灵大小
我已将尺寸为 3264x2448 的 JPG 加载到 Sprite 中。如何按比例调整它的大小以允许我将 Sprite 绘制到 BitmapData 对象中(在 CS3/Flash Player 9 中高度或宽度限制为 2880)。我的目标是使用 Soulwire [DisplayUtils][1] 创建缩略图。这是与其他较小的精灵一起正常工作的代码:
var bmpd:BitmapData = new BitmapData(jpgSprite.width, jpgSprite.height, true, 0x00FFFFFF);
bmpd.draw( jpgSprite );
var thumb:Bitmap = DisplayUtils.createThumb( bmpd, 100, 100, Alignment.MIDDLE, true);
addChild( thumb );
感谢您的建议。
I've loaded a JPG with dimensions 3264x2448 into a Sprite. How can I resize it proprtionally to allow meto draw the Sprite into a BitmapData object (which in CS3/Flash Player 9 is limited to 2880 height or width). My goal is to use the Soulwire [DisplayUtils][1] to create a thumbnail. Here is the code that works fine with other, smaller, Sprites:
var bmpd:BitmapData = new BitmapData(jpgSprite.width, jpgSprite.height, true, 0x00FFFFFF);
bmpd.draw( jpgSprite );
var thumb:Bitmap = DisplayUtils.createThumb( bmpd, 100, 100, Alignment.MIDDLE, true);
addChild( thumb );
thanks for your suggestions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想使用矩阵来缩小它可能会成功。不过我还没有测试过代码。
I guess using a matrix to scale it down might do the trick. I haven't tested the code though.