WoWInterface - View Single Post - Closing all frames with the same name
View Single Post
04-17-20, 09:22 AM   #2
I did that?
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,256
Frames don't get disposed/garbage collected. You should re-use the same frame where possible.

The global name of the first frame created with the same name is stored so you would need to keep track of any frames created yourself, most commonly by adding the reference to a table, or use unique names.

Lua Code:
  1. local MyButtons = {} -- Storage
  3. local function CreateButton(id)
  4.     local f = CreateFrame("Button", "MiltonActionButton"..id, UIParent, "SecureActionButtonTemplate") -- Create your button(s)
  5.     tinsert(MyButtons, f) -- and add to storage
  6.     ...
  7. end
  9. local function HideButtons()
  10.     for i=1, #MyButtons do -- Hide them all
  11.          MyButtons[i]:Hide()
  12.     end
  13. end
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 04-17-20 at 09:39 AM.
  Reply With Quote