Frame:CreateTexture()

From Wowpedia
Jump to: navigation, search

Creates a Texture object within the specified widget.

texture = Frame:CreateTexture(["name"[, "layer"[, "inheritsFrom"[, subLayer]]]])

This method is available on any widget inheriting from Frame.

Parameters

name 
String - Name of the newly created texture; the function will create a global variable mapping this value to the created texture. If nil, the texture is anonymous and no global variable is created.
layer 
String - The layer to the texture should be drawn in, e.g. "ARTWORK".
inheritsFrom 
String - a comma-delimited list of names of virtual textures (created in XML) to inherit from; if nil, the texture does not inherit any properties.
subLayer 
Number - The order in which the texture should be drawn, within the same layer.

Example

The following snippet creates a semi-transparent white background within a frame:

-- assume frame is a Frame
local tex = frame:CreateTexture(nil, "BACKGROUND")
tex:SetAllPoints()
tex:SetColorTexture(1, 1, 1, 0.5)

Patch history

WoW Icon update.png Patch 1.11.0 / API changes (2006-06-19): Can now instantiate virtuals.