Optimizing Perfomance
mProjector 2.0 is dramatically faster than previous versions. The list below gives you more ideas on how to improve the performance of your Flash movies, and your mProjector applications.
- Review your code. Efficient code and clean interfaces run faster. Make sure your swf plays fast in a browser, and as a standard Flash projector.
- Reduce the frame rate to <= 20 frames per second. Most applications don’t require a frame rate of more than 12 fps.
- Watch your application run in TraceViewer on Windows and the Console Utility on the Mac. Add mApplication.enableAutoTrace(true) to the first frame of your movie to verify your application is running as expected. Remove any unnecessasry mProjector commands. For example, if your application is a bouncing ball, stop calling mWindow.setPosition() once the ball has stopped moving. Continuing to call mWindow.setPosition() every 20th of a second can be very taxing and unnecessary.
- Increase setInterval() durations to be >= 50, and clear intervals when they are no longer needed. Most applications don’t require interval durations of more than 80 milliseconds (12 fps).
- Limit gradients to small regions. Each time the window refreshes, it calculates the area that needs to be redrawn - the "invalid" region. If your window has a gradient, and the user moves it one pixel, then the entire window is marked invalid, and needs to be redrawn.
- Reduce the size of your windows - smaller windows mean less pixels to redraw, and thus less work for the processor.
- Call mWindow.freezeShape(true) when not changing the shape of the window (Windows ONLY). This tells mProjector not to re-calculate the window shape for every frame.
- Turn the alpha channel off using mWindow.enableAlphaMode(false) when you need to change the windows shape, but do not need transparency. (Windows ONLY).
- Use rectangular style windows when possible. Windowless style windows are super sexy, but take much more processor power.
- Review these optimization ideas from Adobe
- Look into using faster and more efficient components. Components can have a big impact on the performance of your application.