Using Scaleform

Scaleform GFx is the native GUI for GTA V, based on Flash technology using ActionScript 2, which is a superset of ECMAScript (JavaScript) - read more on Wikipedia.

Development environment

In order to develop custom .gfx assets (optimized SWF) you need to have Adobe Flash Pro CS6, use ActionScript 2 (version 3 has a different virtual machine which is not supported by the version GFx GTA uses) and target Flash Player 8.0.

To convert a .swf file produced by Adobe Flash into .gfx, you need the gfxexport.exe tool from the Scaleform GFx SDK (version 4.0 is fine).

Limitations

Scaleform doesn’t implement some features from Flash:

  • No filters for shapes. At all.
  • No blur filter for text either. Can be faked with a glow filter.
  • No masking. Will be discussed later on this page.
  • No embedded raster graphics. Will be discussed later on this page.

Interfacing

You can interface with scaleforms by performing native calls from the GRAPHICS namespace with scaleform in their name.

This variable serves as a kind of public API of the .gfx.

Boilerplate

It’d be pretty time consuming to explain in details how to bootstrap your first gfx thing, so instead please use the boilerplate:

            <li>
                <a href="//docs/scripting-manual/using-scaleform/_index.files/boilerplate.zip" >
                    boilerplate.zip
                </a>
                (5 kB)
            </li>

Loading

  1. Use REQUEST_SCALEFORM_MOVIE with the name of the desired gfx (without file extension), for example mp_car_stats.
  2. Use HAS_SCALEFORM_MOVIE_LOADED in a loop, to prevent using a non-loaded Scaleform asset.

Invoking functions in GFx

Please note that this is a low-level api, the C# runtime has an easy-to-use high-level abstraction; and even if you don’t know C# you can use it as a reference usage of function calling natives.

> Call BEGIN_SCALEFORM_MOVIE_METHOD to initialize the function call, pass it the handle of the GFx, and a function name string, which should be a member of the global TIMELINE variable in ActionScript.

> Define arguments, using one of the following functions depending on what type of argument you want to pass: