Originally Posted by Phanx
Code:
-- create the parent frame once:
local frame = CreateFrame("Frame", "MyAddon", UIParent)
frame:SetPoint("BOTTOM", UIParent, "CENTER", 0, 100)
frame:SetSize(256, 256)
frame:Hide()
-- create the texture object once:
local tex = frame:CreateTexture(nil, "ARTWORK")
tex:SetAllPoints(true)
frame.texture = tex
-- when you want to show a specific texture:
frame.texture:SetTexture("Interface\\AddOns\\MyAddon\\textures\\blabla")
frame:Show()
|
If you had, say, 4 textures, and you only needed to show one at a time, something like this should work (taking from Phanx's lead).
** Edit: that is some wonky indentation, forum gods!
Code:
-- when you want to show a specific texture:
-- your textures are named "blabla1.tga", "blabla2.tga", etc
local counter
frame:SetScript("OnUpdate", function(self, elapsed)
for i = 1, 4 do
counter = counter + elapsed -- WoW increments in 0.1 seconds
frame.texture:SetTexture("Interface\\AddOns\\MyAddon\\textures\\blabla"..i)
frame:Show()
if counter == 2 then
-- hide this frame at two seconds
frame:Hide()
end
counter = 0
end
end)