开发者

Tween sprite or uicomponent?

开发者 https://www.devze.com 2023-04-05 19:44 出处:网络
I need to move 100+ sprites from right to left, for example, a hundred musical notes will be scrolling horizontally should be as smooth as possible, having tried move s:Group component found it to be

I need to move 100+ sprites from right to left, for example, a hundred musical notes will be scrolling horizontally should be as smooth as possible, having tried move s:Group component found it to be inefficient with high CPU load even after apply updateafterevent(). Is it possible to scro开发者_JAVA技巧ll a large numbers of sprite smoothly?

Using Flash builder 4.


I've been working on a game engine for some time that uses BitmapData and its copyPixels() function to render extremely quickly.

The process is basically:

  1. Create a Bitmap object and attach it to the stage - this will be your Canvas.
  2. Create an instance of BitmapData that represents the graphics for your notes (sprite sheet type) - this can be generated on the fly using BitmapData's draw() method.
  3. Create a class for your notes that has a property representing a reference to this sprite sheet.
  4. Loop through each of these objects and use copyPixels() from the Canvas to parse reference to the related BitmapData.

If you visit my website you'll see a little demo of what the engine I've been working on that does the above can handle - 4000+ objects.

Many objects rendering smoothly:

Tween sprite or uicomponent?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号