I have a frame with a texture that is defined in xml:
Code:
<CheckButton name="BagnonReagentbankToggleTemplate" inherits="BagnonMenuCheckButtonTemplate" virtual="true">
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\Icons\Achievement_GuildPerk_BountifulBags"/>
</Layer>
</Layers>
</CheckButton>
Under certain circumstances, I want to change this texture in my lua code:
Code:
function ReagentbankToggle:Update()
if (not IsReagentBankUnlocked()) then
local tex = self:CreateTexture(nil, "OVERLAY")
tex:SetAllPoints()
tex:SetTexture('Interface/Icons/Achievement_GuildPerk_BountifulBags');
tex:SetVertexColor(1,0.1,0.1)
end
end
But this solution always draws a new Texture on top of the others. With \fstack I can see them becoming more and more with every Update(). Isn't there a way to just alter the already existing texture? Or at least delete the old one before creating the new one?
My problem might just be that I don't know how to get a handle for the old texture into a variable...