Scaleform GFx FAQ: Art and Asset Development

This section covers art-related issues, including sharing art resources, stitching images, handling movie clips, support of different resolutions and aspect ratios, and creating SWF files.

What aspects should our artists consider when working with GFx to optimize performance?

We recommend that artists test their files during development in GFx Player (and not just Flash) to ensure optimal performance. You can use the F2 key in GFx Player to display onscreen stats that report memory use and rendering statistics. Artists should make sure the reported memory use is appropriate for the target platform. Key things to consider when structuring files to reduce triangle count:

Can we dynamically change menu navigation?

It is possible to dynamically change menu contents using ActionScript; to do so, you may need to store menu items in an array and generate movie clips for items programmatically.

How do you handle different resolutions (e.g., 4:3, 16:9, 16:10)?

Since Flash makes use of vector shapes, they can be scaled to any resolution and aspect ratio without losing quality. Supporting a given resolution is a matter of configuring the target viewport correctly.

For supporting different screen aspect ratios and resolutions, you can set Stage.scaleMode to "noScale" and write some simple ActionScript logic that positions and scales top-level panels based Stage.width and Stage.height (this can be done in Frame 1, for example). If you do not do this and simply stretch the viewport, your content will be either stretched or centered, depending on the Stage class settings. See this helpful forum post for more information about the GViewport class.

GFx 2.2 introduces several extensions, which may help in repositioning and resizing objects on the stage, including Stage.visibleRect : flash.geom.Rectangle and Stage.originalRect : flash.geom.Rectangle. Stage.visibleRect contains the currently visible rectangle. This rectangle is changed when the aspect ratio, scale mode, alignment, and/or scale of the viewport are changed. This rectangle may have negative topLeft corner coordinates. The Stage.originalRect property always contains the original SWF’s rectangle with the original SWF’s dimensions. These dimensions also may be used for recalculating and repositioning objects on the stage.

The Stage.onResize handler has an extra parameter as an extension. This parameter contains the same value as that returned by Stage.visibleRect. See AS2 Extensions Reference for more details.

Do you support "Safe Frame"?

Safe frame support is the responsibility of the developer. It is possible to set up a Flash rendering viewport that will occupy only the part of the screen that is guaranteed to be visible on the TV (see this forum post for more details).

Alternatively, artists can use guide layers in the Flash MX studio to assist them in creating safe-frame friendly content. GFx 2.2 introduces the ability to set and retrieve the safe rectangle. There are two new methods in GFxMovieView class: SetSafeRect and GetSafeRect. Stage ActionScript class also has an extension property, Stage.safeRect, that allows the use of the safe rectangle in ActionScript. For more details, please refer AS2 Extensions Reference.

Is there a way to efficiently and cleanly tile an image? I would like to be able to dynamically load an image and have the image tiled based on how large the containing movie clip is.

At the moment, there is no API available that would allow you to do tiling with loadMovie images. However, loading many small movies for tiling is probably best avoided for performance, memory and image stitching reasons.

If you are trying to create backgrounds, we suggest embedding the image in the SWF file, which will allow you to tile it in Flash Studio. If necessary, those images can be substituted with dynamic images based on their export name; you can rely on GFxImageCreator and/or the GFxMovieDef::GetResource methods to do so.

How are art resources shared in GFx?

The standard way of sharing resources in Flash makes use of imported symbols from a shared SWF file. When the shared file is loaded, font resources, movie clips, and images will be automatically shared among all the files that rely on it.

In addition to explicit import sharing, it is possible for users to set up their own sharing with use of the GFxExport tool, which produces images that can be matched and eliminated (such matching can work either off export names or content). Users can set up their own image library and provide shared image pointers through a custom GFxImageCreator::CreateImage implementation. Since this function receives information about where the image is coming from, you can use a map or hashtable to enable sharing.

If I put an imported movie clip on the stage I only see a "reference dot" and not the actual movie clip, so I can't lay out my assets correctly. How can I see the clip?

To see an imported movie clip in your exporting Flash file, you need to have the source FLA file that contains the imported movie. If you have it, right-click on the imported movie clip in the Library and select "Properties ... " You will see the "Symbol Properties" window. At the bottom of this window, there is a "Source" section. Here you can specify the full path to the source FLA file that contains the imported movie clip as well as choose its symbol name in this FLA file. Once this is completed, the actual movie clip appears on the stage of exporting Flash file.

Should we ship SWF files, or always convert them to GFx?

Typically SWF files should be converted to GFx format before publication with the GFxExport.exe tool. Preprocessing the SWF files with GFxExport extracts images into DDS files, which reduces memory use and offers some additional options such as font data stripping and compression. Generating GFx files has an additional benefit of preventing users from customizing UI assets. Direct use of SWF files is appropriate for development when Flash artists will need to swap out Flash files while testing new art assets.

Which blend modes are supported in GFx?

We only support Normal, Add, Multiply, and Subtract blend modes. Even for these modes, the behavior may be different, because Flash passes all the rendering through an extra buffer (flattening shapes), which GFx currently does not do. There may be some additional limitations for lower-end consoles such as “PSP®” and Wii™.

We see quality degradation of our images in GFxPlayer, why is that?

Your images should have power of 2 dimensions to avoid quality loss. Images that are not power of 2 will be resized by GFx to the nearest power of 2, which may negatively affect the quality of your images. Image degradation may occur since a number of video cards only support power of 2 textures, and all SWF images are being converted to textures for 3D accelerated rendering.