带位图的 AS3 动画
我正在 ActionScript 3 中做一个动画类,想知道最有效的方法。 目前我所做的是获取图像(精灵表)并将所有帧保留在位图数组中,然后将每个帧添加为子帧,并设置 setVisible = false 除了我必须显示的帧。
我能想到的另一种方法是只添加一个位图作为子项,并且每次必须更改时间帧时,我使用 copyPixels 函数将像素复制到位图。
有比这两种选择更有效的方法吗?
谢谢
I'm doing an animation class in ActionScript 3 and would like to know the most efficient way to do it.
Currently what I do is get an image (sprite sheet) and keep all the frames in an array of Bitmaps, then add each frame as a child and I put setVisible = false except the frame I have to show.
The other way I can think of is to have only one Bitmap added as a child and every time frame has to be changed, I copy the pixels to the Bitmap using copyPixels function.
There is somewhat more efficient than either of these alternatives?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将所有帧保存在
BitmapData
向量中。然后,当您想要更改帧时,使用单个位图并更改其位图数据属性。Keep all your frames in a vector of
BitmapData
. Then use a singleBitmap
and change it'sbitmapData
property when you want to change frames.Copypixels
速度相当快。对渲染方法进行了很好的比较 这里是8bitrocket.com;我建议读一读。
Copypixels
is quite fast.There's an excellent comparison of rendering methods here at 8bitrocket.com; I would suggest giving it a read.