You're mixing up the UIFrameFade and UIFrameFade
In functions.
finishedFunc is not an attribute of the frame object. Its a value within an additional fadeInfo table that is build inside the UIFrameFadeIn and UIFrameFadeOut functions or has to be passed as an argument with UIFrameFade.
Example for UIFrameFade:
Code:
function VoiceChatShineFadeIn()
-- Fade in the shine and then fade it out with the ComboPointShineFadeOut function
local fadeInfo = {};
fadeInfo.mode = "IN";
fadeInfo.timeToFade = 0.5;
fadeInfo.finishedFunc = VoiceChatShineFadeOut;
UIFrameFade(VoiceChatShine, fadeInfo);
end
function VoiceChatTalkers_FadeOut()
local fadeInfo = {};
fadeInfo.mode = "OUT";
fadeInfo.timeToFade = .35;
fadeInfo.startAlpha = 1;
fadeInfo.endAlpha = 0;
fadeInfo.finishedFunc = function() if ( #VOICECHAT_TALKERS > 0 ) then return end VoiceChatTalkers.buttons[1].button:SetAttribute("name", nil); VoiceChatTalkers.buttons[1]:Hide() VoiceChatTalkersSpeaker:Show() end;
UIFrameFade(VoiceChatTalkers, fadeInfo);
VoiceChatTalkers.visible = 0;
end
The UIFrameFade, UIFrameFadeIn, and UIFrameFadeOut implementations to clarify this:
Code:
-- Generic fade function
function UIFrameFade(frame, fadeInfo)
if (not frame) then
return;
end
if ( not fadeInfo.mode ) then
fadeInfo.mode = "IN";
end
local alpha;
if ( fadeInfo.mode == "IN" ) then
if ( not fadeInfo.startAlpha ) then
fadeInfo.startAlpha = 0;
end
if ( not fadeInfo.endAlpha ) then
fadeInfo.endAlpha = 1.0;
end
alpha = 0;
elseif ( fadeInfo.mode == "OUT" ) then
if ( not fadeInfo.startAlpha ) then
fadeInfo.startAlpha = 1.0;
end
if ( not fadeInfo.endAlpha ) then
fadeInfo.endAlpha = 0;
end
alpha = 1.0;
end
frame:SetAlpha(fadeInfo.startAlpha);
frame.fadeInfo = fadeInfo;
frame:Show();
local index = 1;
while FADEFRAMES[index] do
-- If frame is already set to fade then return
if ( FADEFRAMES[index] == frame ) then
return;
end
index = index + 1;
end
tinsert(FADEFRAMES, frame);
frameFadeManager:SetScript("OnUpdate", UIFrameFade_OnUpdate);
end
-- Convenience function to do a simple fade in
function UIFrameFadeIn(frame, timeToFade, startAlpha, endAlpha)
local fadeInfo = {};
fadeInfo.mode = "IN";
fadeInfo.timeToFade = timeToFade;
fadeInfo.startAlpha = startAlpha;
fadeInfo.endAlpha = endAlpha;
UIFrameFade(frame, fadeInfo);
end
-- Convenience function to do a simple fade out
function UIFrameFadeOut(frame, timeToFade, startAlpha, endAlpha)
local fadeInfo = {};
fadeInfo.mode = "OUT";
fadeInfo.timeToFade = timeToFade;
fadeInfo.startAlpha = startAlpha;
fadeInfo.endAlpha = endAlpha;
UIFrameFade(frame, fadeInfo);
end