davivid
davivid

Reputation: 5960

AS3 Bad performance at edges of large stage

Using a large stage size of 3840 x 2160, I see performance issues when animating small sprites towards the edges of the stage.

I can add hundreds of these to the stage with no problem, but if any are near the edges, problems occur. Is there anything I can do to fix this?

Update:

sprite.cacheAsBitmap = true was causing the problem for me. Setting to false fixed the issue.

Upvotes: 4

Views: 214

Answers (1)

Creynders
Creynders

Reputation: 4583

This probably has to do with how flash player renders the screen. It redraws everything in between the four outermost to-be-redrawn coordinates. (most left, most right, most up, most down)

Meaning that if you've got only two pixels at coordinate 1600,1000 and one at 1800,1200 that have changed in between frames, then only an area of 200x200 pixels is redrawn. If however you have a pixel at 10,10 and one at 3830,2150 that need to be redrawn, then an area of 3820x2140 pixels needs to be rerendered. That's mucho pixels. (8.174.800)

This is true even if nothing else has changed in between those four outermost pixels.

Upvotes: 1

Related Questions