Skip to content

Element

GenericUI_Element is the base class that all built-in elements inherit from.

GenericUI_Element Class

Methods

AddChild
function GenericUI_Element:AddChild(id, elementType)
   -> `T`

@param id string

@param elementType `T`|GenericUI_ElementType

Destroy
function GenericUI_Element:Destroy()
GetChildIndex
function GenericUI_Element:GetChildIndex()
   -> integer -- 1-based.

Returns the child index of this element within its parent.

GetChildren
function GenericUI_Element:GetChildren()
   -> GenericUI_Element[]

Returns the children of the element.

GetGlobalPosition
function GenericUI_Element:GetGlobalPosition()
   -> Vector2

Returns the global position of the element within the UI.

GetHeight
function GenericUI_Element:GetHeight(considerOverrides)
   -> number

Returns the height of the element.

@param considerOverrides boolean? If `true`, height overrides will be considered. Defaults to `true`.

GetMovieClip
function GenericUI_Element:GetMovieClip()
   -> FlashMovieClip

Get the movie clip of this element.

GetParent
function GenericUI_Element:GetParent()
   -> GenericUI_Element

Returns the parent element.

GetPosition
function GenericUI_Element:GetPosition()
   -> number, number -- X and Y coordinates in local space.
GetRawHeight
function GenericUI_Element:GetRawHeight()
   -> number

Returns the height of the element without considering its children.

GetRawSize
function GenericUI_Element:GetRawSize()
   -> Vector2

Gets the size of the element without considering its children.

GetRawWidth
function GenericUI_Element:GetRawWidth()
   -> number

Returns the width of the element without considering its children.

GetScale
function GenericUI_Element:GetScale()
   -> Vector2

Returns the scale of the element.

GetScreenPosition
function GenericUI_Element:GetScreenPosition(floor)
   -> Vector2 -- With decimals.

Returns the position of the element in screen-space.

@param floor boolean? If `true`, values returned will be floored. Defaults to `true`.

GetSize
function GenericUI_Element:GetSize(considerOverrides)
   -> Vector2

Returns the size of the element.

@param considerOverrides boolean? If `true`, width/height overrides will be considered. Defaults to `true`.

GetSizeOverride
function GenericUI_Element:GetSizeOverride()
   -> Vector2?

Returns the size override of the element, if any.

GetWidth
function GenericUI_Element:GetWidth(considerOverrides)
   -> number

Returns the width of the element.

@param considerOverrides boolean? If `true`, width overrides will be considered. Defaults to `true`.

IsVisible
function GenericUI_Element:IsVisible()
   -> boolean

Returns whether the element is visible.

Move
function GenericUI_Element:Move(x, y)

Moves the element a certain amount of pixels from its current position.

@param x number

@param y number

RemoveChild
function GenericUI_Element:RemoveChild(element)

@param element GenericUI_Element

RemoveScrollRect
function GenericUI_Element:RemoveScrollRect()

Removes the scroll rect from the element, if any.

SetAlpha
function GenericUI_Element:SetAlpha(alpha, affectChildren)

@param alpha number

@param affectChildren boolean? Defaults to not affecting children alpha.

SetAsDraggableArea
function GenericUI_Element:SetAsDraggableArea()

Sets this element as the area for dragging the entire UI.

SetCenterInLists
function GenericUI_Element:SetCenterInLists(center)

Sets whether the element should be horizontally centered in VerticalList and ScrollList.

@param center boolean

SetChildIndex
function GenericUI_Element:SetChildIndex(child, index)

Sets the Z-order index of a child element.

@param child string|GenericUI_Element

@param index integer

SetMouseChildren
function GenericUI_Element:SetMouseChildren(enabled)

@param enabled boolean

SetMouseEnabled
function GenericUI_Element:SetMouseEnabled(enabled)

@param enabled boolean

SetMouseMoveEventEnabled
function GenericUI_Element:SetMouseMoveEventEnabled(enabled)

Sets whether the element can throw MouseMove events.

These are disabled by default.

@param enabled boolean

SetPosition
function GenericUI_Element:SetPosition(x, y)

@param x number

@param y number

SetPositionRelativeToParent
function GenericUI_Element:SetPositionRelativeToParent(position, horizontalOffset, verticalOffset)

Sets the position of the element relative to its parent.

@param position GenericUI_Element_RelativePosition

@param horizontalOffset number?

@param verticalOffset number?

SetRotation
function GenericUI_Element:SetRotation(degrees)

@param degrees number

SetScale
function GenericUI_Element:SetScale(scale)

Sets the scale of the element.

@param scale Vector2

SetScrollRect
function GenericUI_Element:SetScrollRect(position, size)

Sets the scroll rect of the element.

@param position Vector2

@param size Vector2

SetSize
function GenericUI_Element:SetSize(width, height)

@param width number

@param height number

SetSizeOverride
function GenericUI_Element:SetSizeOverride(width, height)

Sets the size override, used to override the element size within list-like elements.

@param width number

@param height number

SetTooltip
function GenericUI_Element:SetTooltip(tooltipType, tooltip)

Sets the tooltip of the element.

@param tooltipType TooltipLib_TooltipType

@param tooltip any? TODO document

SetVisible
function GenericUI_Element:SetVisible(visible)

@param visible boolean

Tween
function GenericUI_Element:Tween(tween)

@param tween GenericUI_ElementTween

__UpdateChildOrder
---@protected
function GenericUI_Element:__UpdateChildOrder()

Updates the order of the internal children table by MC child index.