Menu
Lumberyard
Developer Guide (Version 1.11)

ScriptBind_UIAction

CryLua is deprecated and will be removed in a future version of Lumberyard.

CallFunction

Calls a function of the UI flash asset or the UIEventSystem.

Syntax

Copy
UIAction.CallFunction(elementName, instanceID, functionName, [arg1], [arg2], [...])

Parameter Description
elementName The UI element name as defined in the XML or UIEventSystem name as defined in a .cpp file.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances. If used on UIEventSystem, no instance ID is ignored.
functionName Function or event name.
args List of arguments (optional).

DisableAction

Disables the UI Action.

Syntax

Copy
UIAction.DisableAction(actionName)

Parameter Description
actionName UI Action name.

EnableAction

Enables the UI Action.

Syntax

Copy
UIAction.EnableAction(actionName)

Parameter Description
actionName UI Action name.

EndAction

Ends a UI Action. This can be only used within a UIAction Lua script!

Syntax

Copy
UIAction.EndAction(table, disable, arguments)

Parameter Description
table Must be self.
disable If true, this action is disabled when it terminates.
arguments The arguments to return from this action.

GetAlpha

Get move clip alpha value.

Syntax

Copy
UIAction.GetAlpha(elementName, instanceID, mcName)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
mcName The movie clip name as defined in the XML.

GetArray

Returns a table with values of the array.

Syntax

Copy
UIAction.GetArray(elementName, instanceID, arrayName)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
arrayName Array name as defined in the XML.

GetPos

Get movie clip position.

Syntax

Copy
UIAction.GetPos(elementName, instanceID, mcName)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
mcName The movie clip name as defined in the XML.

GetRotation

Get movie clip rotation.

Syntax

Copy
UIAction.GetRotation(elementName, instanceID, mcName)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). '-1' for all instances
mcName The movie clip name as defined in the XML.

GetScale

Get movie clip scale.

Syntax

Copy
UIAction.GetScale(elementName, instanceID, mcName)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
mcName The movie clip name as defined in the XML.

GetVariable

Gets a variable of the UI flash asset.

Syntax

Copy
UIAction.GetVariable(elementName, instanceID, varName)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
varName Variable name as defined in the XML.

GotoAndPlay

Call GotoAndPlay on a movie clip.

Syntax

Copy
UIAction.GotoAndPlay(elementName, instanceID, mcName, frameNum)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
mcName The movie clip name as defined in the XML.
frameNum The frame number.

GotoAndPlayFrameName

Call GotoAndPlay on a movie clip by frame name.

Syntax

Copy
UIAction.GotoAndPlayFrameName(elementName, instanceID, mcName, frameName)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
mcName The movie clip name as defined in the XML.
frameName The name of the frame.

GotoAndStop

Call GotoAndStop on a movie clip.

Syntax

Copy
UIAction.GotoAndStop(elementName, instanceID, mcName, frameNum)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
mcName The movie clip name as defined in the XML.
frameNum The frame number.

GotoAndStopFrameName

Call GotoAndStop on a movie clip by frame name.

Syntax

Copy
UIAction.GotoAndStopFrameName(elementName, instanceID, mcName, frameName)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
mcName The movie clip name as defined in the XML.
frameName The name of the frame.

HideElement

Hide the UI flash asset.

Syntax

Copy
UIAction.HideElement(elementName, instanceID)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.

IsVisible

Get movie clip visible state.

Syntax

Copy
UIAction.IsVisible(elementName, instanceID, mcName)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
mcName The movie clip name as defined in the XML.

RegisterActionListener

Register a callback function for a UIAction event. The callback function must have form: CallbackName(actionName, eventName, argTable)

Syntax

Copy
UIAction.RegisterActionListener(table, actionName, eventName, callbackFunctionName)

Parameter Description
table The script that receives the callback (can be self to refer the current script).
actionName The UI action name.
eventName

The name of the event that is fired from the UI action (can be OnStart or OnEnd)

Warning

If an empty string is specified, all events will be received.

callbackFunctionName The name of the script function that will receive the callback.

RegisterElementListener

Register a callback function for a UIElement event. The callback function must have form: CallbackName(elementName, instanceId, eventName, argTable)

Syntax

Copy
UIAction.RegisterElementListener(table, elementName, instanceID, eventName, callbackFunctionName)

Parameter Description
table The script that receives the callback (can be self to refer the current script).
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
eventName The name of the event that is fired from the UI element. If an empty string is specified, all events will be received.
callbackFunctionName name of the script function that will receive the callback.

RegisterEventSystemListener

Register a callback function for a UIEventSystem event. The callback function must have form: CallbackName(actionName, eventName, argTable)

Syntax

Copy
UIAction.RegisterEventSystemListener(table, eventSystem, eventName, callbackFunctionName)

Parameter Description
table The script that receives the callback (can be self to refer the current script).
eventSystem The UI event system name.
eventName The name of the event that is fired from UIEventSystem. If an empty string is specified, all events will be received.
callbackFunctionName name of the script function that will receive the callback.

ReloadElement

Reloads the UI flash asset.

Syntax

Copy
UIAction.ReloadElement(elementName, instanceID)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.

RequestHide

Send the fade out signal to the UI flash asset.

Syntax

Copy
UIAction.RequestHide(elementName, instanceID)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.

SetAlpha

Set movie clip alpha value.

Syntax

Copy
UIAction.SetAlpha(elementName, instanceID, mcName, fAlpha)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
mcName The movie clip name as defined in the XML.
fAlpha Alpha value (0-1).

SetArray

Sets an array of the UI flash asset.

Syntax

Copy
UIAction.SetArray(elementName, instanceID, arrayName, values)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
arrayName The array name as defined in the XML.
values Table of values for the array.

SetPos

Set movie clip position.

Syntax

Copy
UIAction.SetPos(elementName, instanceID, mcName, vPos)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
mcName The movie clip name as defined in the XML.
vPos position.

SetRotation

Set movie clip rotation.

Syntax

Copy
UIAction.SetRotation(elementName, instanceID, mcName, vRotation)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
mcName The movie clip name as defined in the XML.
vRotation The rotation.

SetScale

Set movie clip scale.

Syntax

Copy
UIAction.SetScale(elementName, instanceID, mcName, vScale)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
mcName The movie clip name as defined in the XML.
vScale scale.

SetVariable

Sets a variable of the UI flash asset.

Syntax

Copy
UIAction.SetVariable(elementName, instanceID, varName, value)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
varName Variable name as defined in the XML.
value Value to set.

SetVisible

Set movie clip visible state.

Syntax

Copy
UIAction.SetVisible(elementName, instanceID, mcName, bVisible)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.
mcName The movie clip name as defined in the XML.
bVisible visible.

ShowElement

Displays the UI flash asset.

Syntax

Copy
UIAction.ShowElement(elementName, instanceID)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.

StartAction

Starts a UI Action.

Syntax

Copy
UIAction.StartAction(actionName, arguments)

Parameter Description
actionName UI Action name.
arguments The arguments to pass to this action.

UnloadElement

Unloads the UI flash asset.

Syntax

Copy
UIAction.UnloadElement(elementName, instanceID)

Parameter Description
elementName The UI element name as defined in the XML.
instanceID The ID of the instance (if an instance with the specified ID does not exist, it will be created). -1 specifies all instances.

UnregisterActionListener

Unregister callback functions for a UIAction event.

Syntax

Copy
UIAction.UnregisterActionListener(table, callbackFunctionName)

Parameter Description
table The script that receives the callback (can be self to refer the current script).
callbackFunctionName The name of the script function that receives the callback. If "" is specified, all callbacks for this script will be removed.

UnregisterElementListener

Unregister callback functions for a UIElement event.

Syntax

Copy
UIAction.UnregisterElementListener(table, callbackFunctionName)

Parameter Description
table The script that receives the callback (can be self to refer the current script).
callbackFunctionName The name of the script function that receives the callback. If "" is specified, all callbacks for this script will be removed.

UnregisterEventSystemListener

Unregister callback functions for a UIEventSystem event.

Syntax

Copy
UIAction.UnregisterEventSystemListener(table, callbackFunctionName)

Parameter Description
table The script that receives the callback (can be self to refer the current script).
callbackFunctionName The name of the script function that receives the callback. If "" is specfied, all callbacks for this script will be removed.