I’m in the process of creating a mod which has a number of boxes (frames and buttons), I’m trying to make a function that sets the colour of the previous box to black when it’s finished being used but I’m having lots of trouble doing this dynamically. Here’s what I’m using…
function ClearLastAction()
-- returns the last active frame to black so only the newest action is green
local kids = { Mod_Status:GetChildren() };
for _, child in ipairs(kids) do
local frameName = child:GetName();
if (frameName == lastAction) then
print("matched frameName to lastAction")
child:SetColorTexture(0,0,0,1);
return
end
All of my frames are children of Mod_Status and it finds the right frame but the Background Layer of the lastAction frame is what I need to change. I’ve tried child:SetColorTexture, I’ve tried using child:GetRegion() (and got lost in the process…) and I’ve tried child.NameOfSubFeature:SetTexture but I haven’t been able to make any headway with any of these options.
Can anyone think of a way to change the background colour in a similar way? For reference here is how the layer is defined in XML.
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parent_Background" setAllPoints="true">
<Color r="0" g="0" b="0" a="1" />
</Texture>
</Layer>
</Layers>
Edit: I was able to use child:GetRegions():SetColorTexture(0,0,0,1); and that worked flawlessly. Luckily I only have one region in there so it works fine.