View Single Post
02-26-13, 04:47 PM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Well, there is a typo in that code that I just noticed. I edited my previous post to fix it.

However, it looks like SexyCooldown re-shows its frames every time a cooldown starts, so that code won't work anyway. Rather than hiding and showing individual frames, it will probably work better to re-parent them all to the CombatHider frame and just hide and show that, so the hidden/shown state of the inidividual frames doesn't matter:

Code:
-- Add frames to hide in this table:
local FramesToHide = {
	"SexyCooldown2Bar1",
}

local CombatHider = CreateFrame("Frame", "MyCombatHider", UIParent, "SecureHandlerStateTemplate")
CombatHider:SetAllPoints(true)
RegisterStateDriver(CombatHider, "visibility", "[nocombat] hide; show")

CombatHider:RegisterEvent("PLAYER_ENTERING_WORLD")
CombatHider:SetScript("OnEvent", function(self, event)
	for i = #FramesToHide, 1, -1 do
		local frame = _G[FramesToHide[i]]
		if frame then
			frame:SetParent(self)
			tremove(FramesToHide, i)
		end
	end
end)
I chose the PLAYER_ENTERING_WORLD event because it happens *after* PLAYER_LOGIN so hopefully SexyCooldown has finished setting up its frames by then.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote