API Frame CreateTexture

102,543pages on
this wiki
Revision as of 14:56, April 27, 2010 by Dafrito (Talk | contribs)

(diff) ←Older revision | Latest revision (diff) | Newer revision → (diff)
Widget API ← Frame < CreateTexture

CreateTexture is a method on Frame objects that creates and returns a new Texture. CreateTexture allows Lua to create textures that would otherwise only be available to XML. This method also lets developers the option to reuse virtual textures declared in XML.

 Frame:CreateTexture(["textureName"[, "layer"]][, "inheritsFrom"])

Parameters Edit

String - Name of the newly created texture. If nil, no name is assigned. The function will also set a global variable of this name to point to newly created texture.
String - The layer to use.
String - a comma-delimited list of names of virtual frames to inherit from (the same as in XML). If nil, no frames will be inherited. These frames cannot be frames that were created using this function, they must be created using XML with virtual="true" in the tag.

Usage Edit

Generally, either use the SetBackdrop function or use code similar to the following to set a solid color background:

FRAME.texture = FRAME:CreateTexture()

The game will not find image files that did not exist when it was started, so you may need to restart the game for the texture to appear.

Around Wikia's network

Random Wiki