This document contains a growing list of best practices when developing Adobe® Flash® content for use with Autodesk® Scaleform® 4.0 and higher versions. These practices are specifically geared towards improving memory and performance of Flash content in games; however they can also be applicable for other use cases. The content creation section in this document is targeted toward artists and designers, whereas the ActionScript™ (AS) section is targeted toward technical artists and engineers. The Heads-Up Display (HUD) Development section is a general overview of the possible development scenarios for HUD creation. We encourage both artists and engineers to read this section before developing a HUD system with Flash and Scaleform.
This document provides a compilation of a wide variety of information from different sources such as customer support requests, developer forum posts, and various Flash and AS resources on the web. Scaleform can be used on many different platforms (from cell phones to cutting-edge consoles and PCs) and integrated with many different engines, and as a result there are unfortunately no “one size fits all” solutions. Every game and project requires a different solution for optimal memory consumption and performance (e.g., code tweaks may be required when porting from a high-end PC to a handheld platform).
We have tried our best to provide relevant performance data along with these best practices; however, these results will not be the same for your project, as there are many variables to account for. We recommend all User Interface (UI) work be thoroughly tested and alternative solutions should be stress tested for each use case early on in the UI development process.
Flash designers and developers must write code and structure applications in a way that is intuitive and beneficial to themselves as well as to the other people who are working on the same project. This is particularly important in FLA files with many assets. Note that Flash Studio CS5 introduced an XML based content format that replaces the binary .FLA format. This is very useful for versioning and changelist tracking.
As it is common for more than one designer or developer to work on a single Flash project, teams benefit when everyone follows a standard set of guidelines for using Flash, organizing FLA files, and writing AS code. The sections in this document outline the best practices for writing AS and best practices when using the Flash authoring tool to create rich media content. Adopt best practices at all times, whether a designer or a developer, working alone or as part of a team. The following are a few reasons why learning and following best practices is beneficial:
Developers are bound to discover many more when they read these best practices and develop their own good habits. Consider the following topics as a guideline when working with Flash; developers may choose to follow some or all of the recommendations. Developers can also modify the recommendations to suit the way they work. Many of the guidelines in this chapter will help developers utilize a consistent way of working with Flash and writing AS.
Areas of possible optimization in Flash are as follows:
If code runs slowly, it is often a sign that the developer needs to reduce the scope of the application or investigate another method that solves the problem in a more efficient way. Developers should identify and remove bottlenecks, for example, by optimizing graphics or reducing the work done by ActionScript.
Often performance is about perception. If the developer attempts to perform too much work in a single frame, Flash doesn't have time to render the Stage, and the user perceives a slowdown. If the developer breaks up the amount of work being performed into smaller chunks, Flash can refresh the Stage at the prescribed frame rate, and there is no perceived slowdown.