Thread: Bag Lua Problem
View Single Post
07-04-10, 10:13 AM   #4
hairy_palms
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 25
hopefully my next mistake is just as obvious

im trying to hide the backgrounds of the default backpacks, running the commands individually ingame as /script works fine, i thought i might be missing an event, but after 2 hrs browsing API documentation i cant see any events im missing. [EDIT]hmm it seems the BAG_OPEN isnt fireing it works on BAG_UPDATE.

Code:
------------
--Hide Bag Backgrounds
------------

local hiding = CreateFrame("Frame", "stealthbagz");
hiding:RegisterEvent("PLAYER_ENTERING_WORLD")
hiding:RegisterEvent("BAG_UPDATE")
hiding:RegisterEvent("BAG_OPEN")

local function hideBG(self, event, ...)
	for i = 1, NUM_CONTAINER_FRAMES do
		_G["ContainerFrame"..i.."CloseButton"]:Hide() -- works fine
		_G["ContainerFrame"..i.."BackgroundTop"]:Hide()
		_G["ContainerFrame"..i.."BackgroundBottom"]:Hide()
		_G["ContainerFrame"..i.."BackgroundMiddle1"]:Hide()
	end
end

hiding:SetScript("OnEvent", hideBG);

Last edited by hairy_palms : 07-04-10 at 10:38 AM.
  Reply With Quote