Scaleform Build Dependencies

When creating a new Scaleform project, there are some Visual Studio settings that need to be configured prior to compiling. The tutorial already has relative paths in place that you can look at for reference when following the steps below. Keep in mind that $(GFXSDK) is an environment variable defined to the base SDK installation directory. The default location is C:\Program Files\Autodesk\Scaleform\GFx SDK 4.6; if your libs are in a different location, you will need to replace the paths containing $(GFXSDK) to point to the location of the libs on your system. We use “Msvc11” for these examples; if you use Visual Studio 2014, you will need to use Msvc14.

Add Scaleform to the project’s include paths for both the debug and release build configurations:

$(GFXSDK)\Src
$(GFXSDK)\Include

by pasting them into the Visual Studio “Additional Include Directories” field.

If you are using AS3, make sure to directly include the mandatory AS3 class registration file “GFx/AS3/AS3_Global.h” in your application. Developers can customize this file to exclude unneeded AS3 classes.

The following library directories should be added to the “Additional Library Directories” field for all build configurations:

"$(DXSDK_DIR)\Lib\x86";
"$(GFXSDK)\ 3rdParty\expat-2.1.0\lib\$(PlatformName)\Msvc11\Release";
"$(GFXSDK) \3rdParty\pcre\Lib\$(PlatformName)\Msvc11\Release”;
"$(GFXSDK)\3rdParty\zlib-1.2.7\Lib\$(PlatformName)\Msvc11\Release";
"$(GFXSDK)\3rdParty\libpng-1.5.13\Lib\$(PlatformName)\Msvc90\Release”;
"$(GFXSDK)\3rdParty\curl-7.29.0\lib\$(PlatformName)\Msvc90\Release
"$(GFXSDK)\3rdParty\jpeg-8d\Lib\$(PlatformName)\Msvc11\Debug;"
"$(GFXSDK)\Lib\$(PlatformName)\Msvc11\$(ConfigurationName)

Note: Change Msvc11 to the string corresponding to your version of Visual Studio.

Finally, add the Scaleform libraries and their dependencies:

libgfx.lib
libgfx_as2.lib
libgfx_as3.lib
libgfx_air.lib
libgfxexpat.lib
libjpeg.lib
zlib.lib
libcurl.lib
libpng.lib
libgfxrender_d3d9.lib
libgfxsound_fmod.lib

Make sure the sample application still compiles and links in both the debug and release configurations. For reference, a modified .vcproj file with the Scaleform include and linker settings is in the Tutorial\Section3.5 folder.

AS3_Global.h and Obj\AS3_Obj_Global.xxx files

Developers must note that AS3_Global.h and Obj\AS3_Obj_global.xxx are completely unrelated files. AS3_Obj_Global.xxx files contain implementation of so called "global" ActionScript 3 objects. Every swf file contains at least one object called "script", which is a global object. There is also a class GlobalObjectCPP, which is a global object for all classes implemented in C++. This is specific to the Scaleform VM implementation.

AS3_Global.h has a completely different purpose. This file contains the ClassRegistrationTable array. The purpose of this array is to reference C++ classes implementing corresponding AS3 classes. Without this reference, code will be excluded by a linker. So, ClassRegistrationTable has to be defined in your executable, otherwise you will get a linker error. Each of our demo players includes AS3_Global.h for this reason.

The whole purpose of putting the ClassRegistrationTable into an include file and requiring developers to include it, is to allow customization of the ClassRegistrationTable (for the purpose of potential code size reduction). The best way to do that is to make a copy of AS3_Global.h, comment out un-needed classes (after which they will not be linked in), and include the customized version into your app.

However, there is a catch related to this optimization. Because name resolution in the AS3 VM happens at run-time, it is possible that a needed class will not be found if commented out of the table. So, if you want to get rid of "unnecessary" classes, please make sure that your app is functional after that.