Quantcast
WoWInterface - View Single Post - Clear Button Texture and Text LUA Help
View Single Post
04-24-17, 08:42 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,260
Originally Posted by Dejablue View Post
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
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote