Search code examples
apache-flexmacosraster

How to increse performance of raster scrolling on Mac?


I have a game with a big raster map

Now we are using jpeg (4900x4200)

And durring the game we need to scroll through this map.

We use the following:

Class Map extends mx.containers.Canvas

and mx.controls.Image on it

In constructor we have:

public function Map() {
        super();
        image.source = ResourceManager.interactiveManager.map;//big image
        addChild(image);
......
}

for scrolling we are use:

    if(parentAsCanvas==null){
        parentAsCanvas = (parent as Canvas);
    }

    parentAsCanvas.verticalScrollPosition = newX;
    parentAsCanvas.horizontalScrollPosition = newY;

In windows, we have very good performance. In Linux and Mac in flashplayer we have a good performance too.

But in browsers performance is quite slow! What can we do to resolve it?


Solution

  • I've read the following acrticle http://www.insideria.com/2008/04/flex-ria-performance-considera.html

    I and i found the resolve of my problem.

    If i open my SWF in browser as "http://host/myswf.swf" I have huge performance lose in browser as the reason work LaoyoutManager, that recalculates positions and sizes of all canvases in the application. And it process eats more than 60% of performance capacity.(Yep, we have a lot of Canvases in our application).

    And when i putted my application in contant-size html block in html page, all problems were go away! I've got 80% performance increase!