View Single Post
11-24-09, 03:45 PM   #14
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
No - that requires that you have a frame pointer for restoreframe(), which at that point isn't really possible without breaking the illusion that the frame has been "deleted". You would use this, instead:

Code:
local AcquireFrame, ReleaseFrame
do
	local frame_cache = {}

	function AcquireFrame(parent)
		local frame = tremove(frame_cache) or CreateFrame("Frame")
		frame:SetParent(parent)
		return frame
	end

	function ReleaseFrame(frame)
		frame:Hide()
		frame:SetParent(nil)
		frame:ClearAllPoints()
		tinsert(frame_cache, frame)
	end
end	-- do block
I also don't see the purpose in replacing the frame's OnEvent script - perhaps you're thinking of OnUpdate...but that never fires when the frame is hidden anyway.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.

Last edited by Torhal : 11-24-09 at 03:48 PM.
  Reply With Quote