Oh, and another thing. Unless you ABSOLUTELY need your button to have a global name, accessible from outside of your addon, then don't bother giving it a global name. You can just do:
Lua Code:
local frame = CreateFrame("Button", nil, UIParent)
If you DO want it to have a global name, then use the local you are assigning your button to as your reference in the Lua code. Locals are faster than global lookups.
Lua Code:
frame:RegisterForClicks("AnyUp")
frame:SetScript("OnClick", function(self, button, ...)
if (button == "RightButton") then
if frame:IsShown() then
frame:Hide()
else
frame:Show()
end
end
end)
/edit: heh... just noticed that you had the :SetHidden() call backwards anyway