Write a value to a specified value name associated with a registry key.


First available in version 3.0 build 2039.

Input Parameters:

rootKey - The name of one of the main branches of the registry. Valid values include: HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_USERS, HKEY_LOCAL_MACHINE, HKEY_PERFORMANCE_DATA, HKEY_CURRENT_CONFIG, and HKEY_DYN_DATA.

subKey - The name of the key to be accessed. This key must be a subkey of the rootKey.

valueName - [Optional] - The name of the value to be written to the specified subkey. Leave the valuename blank to set the {Default} value for the specified subkey.

type - Indicates the type of data your have supplied in the 'value' argument. Valid values include: REG_DWORD, REG_DWORD_LITTLE_ENDIAN, REG_SZ, REG_EXPAND_SZ, REG_BINARY, and REG_MULTI_SZ.

value - The new value to be written to the registry. The value is supplied as a string version of one of the data types specified by the 'type' argument (see the help for details).

Output Parameters:

No output parameters.

Asynchronous Mode:

When this method is called asynchronously, a return object containing the output parameters is passed to the specified callback function.

ssCore.Registry.setValue( paramsObject [, callbackParamsObject] [, errorParamsObject] );

Synchronous Mode:

When this method is called synchronously, a return object containing the output parameters is returned to the caller immediately.

var returnObject = ssCore.Registry.setValue( paramsObject );




ssCore.Registry.setValue({rootKey:"HKEY_CURRENT_USER", subKey:"Software\\Test", valueName:"MyValue", type:"REG_SZ", value:"Hello"});

When specifying the REG_MULTI_SZ type use _global.toMultiString for ActionScript 1, StringUtils.toMultiString for ActionScript 2, or StringUtils.toMultiString for ActionScript 3 to convert the values into a format that SWF Studio can use.

import northcode.utils.StringUtils;

var msz = StringUtils.toMultiString("value1", "value2", "valueN");

ssCore.Registry.setValue({rootKey:"HKEY_CURRENT_USER", subKey:"Software\\Test", valueName:"MyValue", type:"REG_MULTI_SZ", value:msz});