Thread: UIFrameFade
View Single Post
06-10-11, 05:31 PM   #3
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Saiket View Post
Your OnEvent function doesn't have "self" or "unit" arguments. Change line 14 to this and it should work:
lua Code:
  1. f:SetScript('OnEvent', function(self, event, unit)
Hmm, nop didn't work


LUA Code:
  1. local f = CreateFrame('Frame')
  2.     f:RegisterEvent("UNIT_SPELLCAST_SENT")
  3.     f:RegisterEvent("UNIT_SPELLCAST_START")
  4.     f:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
  5.     f:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
  6.     f:RegisterEvent("UNIT_SPELLCAST_STOP")
  7.     f:RegisterEvent('UNIT_SPELLCAST_FAILED')
  8.     f:RegisterEvent('UNIT_SPELLCAST_INTERRUPTED')
  9.     f:RegisterEvent('UNIT_SPELLCAST_DELAYED')
  10.     f:RegisterEvent('UNIT_SPELLCAST_CHANNEL_UPDATE')
  11.     f:RegisterEvent('UNIT_SPELLCAST_CHANNEL_INTERRUPTED')
  12.     f:SetScript('OnEvent', function(self, event, unit)
  13.         if unit == "player" or unit == "target" or unit == "focus" or unit == "pet" then
  14.             if self.Castbar then
  15.                 if event == "UNIT_SPELLCAST_START" or event == "UNIT_SPELLCAST_CHANNEL_START" then
  16.                     UIFrameFadeIn(self.Castbar, 0.8, self.Castbar:GetAlpha(), 1)
  17.                 elseif event == "UNIT_SPELLCAST_STOP" or event == "UNIT_SPELLCAST_SENT" or event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_INTERRUPTED" or event == "UNIT_SPELLCAST_CHANNEL_STOP" then
  18.                     UIFrameFadeOut(self.Castbar, 0.8, self.Castbar:GetAlpha(), 0.2)
  19.                 end
  20.             end
  21.         end
  22.     end)
  Reply With Quote