Originally Posted by Dejablue
This is the latest attempt in the OP code:
Code:
if ((_G["BMUDButtonFS"..name])~=nil) then
BMUDButton:SetNormalTexture(nil,"ARTWORK")
BMUDButton:SetPushedTexture(nil,"ARTWORK")
BMUDButton:SetHighlightTexture(nil,"ARTWORK")
BMUDButtonFS:SetFormattedText("")
end
Yeah, BAG_UPDATE event fires a billion times and is more of a debugging event that i can use at a vendor to sell and rebuy my beacons to see if this works.
Thanks for taking the time. Let me know if you think of anything else
|
That code doesn't actually do anything because you're checking if a Fontstring you've just created exists, and it always will because, you've just created a new one, along with a new parent button.
if BAG_UPDATE fires a billion times your code will have created a billion new buttons and fontstrings.
Rather than this, you need to check if a button of the same name exists before you create a new one:
Code:
local BMUDButton
if not _G["BMUDButton"..name] then
BMUDButton = CreateFrame("Button", "BMUDButton"..name, UIParent, "SecureActionButtonTemplate");
-- Create the extra bits here
else
BMUDButton = _G["BMUDButton"..name]
-- reset the extra bits here
end