View Single Post
08-11-14, 12:56 PM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
What you're doing seems like a really strange way to go about adding a custom element to your frame. Why aren't you just creating the objects right away, as I assume you're already creating your health bar etc. right away? Even if you pick an event your frame will receive, and register it correctly, there's just no reason to delay creating an element -- just create it. I'd also recommend making a proper element, rather than just registering some events directly on your frame. The CPoints element can easily be adapted to handle Anticipation instead -- make a copy, rename, and edit.

Oh, and there's no reason to waste memory creating a separate frame for the backdrop; since you're only using a backdrop texture, with no border, you should just use a texture:

Code:
local bg = bar:CreateTexture(nil, "BACKGROUND")
bg:SetPoint("TOPLEFT", -1, 1)
bg:SetPoint("BOTTOMRIGHT", 1, -1)
bg:SetTexture(0, 0, 0)
bar.bg = bg
(No point in even setting a texture file if you're just going to make it black.)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote