First integrated as a plugin for HeroEngine v1.20, Scaleform GFx is an optional 3rd party component (requiring a separate license) supporting the generation of Flash based user interfaces in game engines. Fully integrated alongside HeroEngine's own UI system, Scaleform GFx provides for the development of user interfaces using a well known technology (Flash) with an abundant supply of developers.
Visit their site for additional information ScaleForm
HeroEngine 2009.1 (v1.22.1) included integration of the latest Scaleform GFx SDK, version 2.2.61 (prior to that the integration of Scaleform GFx used version 1.2.33).
Communication with the Scaleform dll from HeroScript is accomplished through a series of external functions.
Invoke an ActionScript Method
Invoking an ActionScript method for a Scaleform GFx control is accomplished via a HeroScript external function
SF_GFx_Invoke(). The calling script must provide a reference to the SFx control, the name of the method to invoke, a list of arguments, and a reference to a string for any resulting return string. Due HeroScript not supporting overloading and its strongly typed nature, the methodArgs list is passed as a list of string with the elements formated in a manner that identifies type and value.
Each element is expected to be in the format:
- <type>=<value> - where type is a single character listed below
- f : float ex. f=.9
- i : integer ex. i=1
- s : narrow string ex. s=Hello World!
- w : wide string ex. w=Hello World!
external function SF_GFx_Invoke( controlID as NodeRef of Class GUIControl, methodName as String, methodArgs as List of String, returnString references String) as Boolean
returnValue as string args as list of string add back "f=.9" to args add back "s=Hello World!" to args add back "i=1" to args SF_GFx_Invoke( myControl, "HelloWorld", args, returnValue )
Setting ActionScript Variables
HeroScript is a strongly typed language, which consequently necessitates different external functions for set/get operations on each type.
An interesting feature of Scaleform is the existence of a "Sticky" construct for GFx variables wherein a set operation on a variable not already declared will retain the value in memory and use it as the default value if/when the variable is subsequently declared by ActionScript.
external function SF_GFx_GetVariable( controlID as NodeRef of Class GUIControl, variableName as String) as String external function SF_GFx_GetVariableDouble( controlID as NodeRef of Class GUIControl, variableName as String) as Float external function SF_GFx_SetVariable( controlID as NodeRef of Class GUIControl, variableName as String, variableValue as String) as Boolean external function SF_GFx_SetVariableUtf16( controlID as NodeRef of Class GUIControl, variableName as String, variableValue as String) as Boolean external function SF_GFx_SetVariableDouble( controlID as NodeRef of Class GUIControl, variableName as String, variableValue as Float) as Boolean
SF_GFx_SetVariableUtf16( myControl, "_level0.Title", "Hello World!" )