View Single Post
08-27-12, 06:24 AM   #1
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Adding show on mouseover to MultiBarLeft

MultiBarLeft doesn't seem to like my mouseover script....

Bar script itself
Lua Code:
  1. local LeftBarPoint1 = "LEFT"
  2. local LeftBarPoint2 = "LEFT"
  3. local LeftBarX = 0
  4. local LeftBarY = 100
  5. local RightshowOnMouseover = true
  6. --create the frame to hold the buttons
  7. local frame4 = CreateFrame("Frame", "Bob_MultiBarLeft", UIParent, "SecureHandlerStateTemplate")
  8. frame4:SetWidth(num*Buttonsize + (num-1)*Buttonmargin + 2*Buttonpadding)
  9. frame4:SetHeight(Buttonsize + 2*Buttonpadding)
  10. frame4:SetPoint(LeftBarPoint1,UIParent,LeftBarPoint2,LeftBarX,LeftBarY)
  11. frame4:SetScale(BarScale)
  12. --move the buttons into position and reparent them
  13. MultiBarLeft:SetParent(frame)
  14. MultiBarLeft:EnableMouse(false)
  15. for i=1, num do
  16.     local button = _G["MultiBarLeftButton"..i]
  17.     table.insert(buttonList, button) --add the button object to the list
  18.     button:SetSize(Buttonsize, Buttonsize)
  19.     button:ClearAllPoints()
  20.     if i == 1 then
  21.       button:SetPoint("BOTTOMLEFT", frame4, Buttonpadding, Buttonpadding)
  22.     else
  23.       local previous = _G["MultiBarLeftButton"..i-1]
  24.         button:SetPoint("TOP", previous, "BOTTOM", 0, Buttonmargin)
  25.     end
  26. end
  27. --show/hide the frame on a given state driver
  28. RegisterStateDriver(frame4, "visibility", "[petbattle] hide; [vehicleui] hide; show")

mouseover script
Lua Code:
  1. --Show on mouseover
  2. if LeftshowOnMouseover then    
  3.     local function Fade(alpha)
  4.         if MultiBarLeft:IsShown() then
  5.             for i = 1,12 do
  6.                 local button = _G["MultiBarLeftButton"..i]
  7.                 button:SetAlpha(alpha)
  8.             end
  9.         end
  10.     end    
  11.     MultiBarLeft:EnableMouse(true)
  12.     MultiBarLeft:SetScript("OnEnter", function(self) Fade(1) end)
  13.     MultiBarLeft:SetScript("OnLeave", function(self) Fade(0) end)  
  14.     for i = 1,12 do
  15.         local button = _G["MultiBarLeftButton"..i]
  16.         button:SetAlpha(0)
  17.         button:HookScript("OnEnter", function(self) Fade(1) end)
  18.         button:HookScript("OnLeave", function(self) Fade(0) end)
  19.     end
  20. end

This same script seems to work fine for MultiBarRight
__________________
Tweets YouTube Website

Last edited by 10leej : 08-27-12 at 07:18 AM.
  Reply With Quote