Jump to content

onClientMouseLeave and onClientMouseEnter Help


xXMADEXx

Recommended Posts

Hey guys, I tried making it, so that when you hover over an image, it adjusts the alpha, and when you're cursor leave the image, i puts the alpha back to 255

    -- Alpha Functions -- 
    -- Dim on hover 
    addEventHandler( "onClientMouseEnter", rog_ucp_main_img_sms, 
        function () 
            setElementAlpha(rog_ucp_main_img_sms,100) 
        end 
    ) 
     
    addEventHandler( "onClientMouseEnter", rog_ucp_main, 
        function () 
            setElementAlpha(rog_ucp_main,100) 
        end 
    ) 
     
    -- Back when leave 
    addEventHandler("onClientMouseLeave",rog_ucp_main, 
        function () 
            setElementAlpha(rog_ucp_main,255) 
        end 
    ) 
     
    addEventHandler("onClientMouseLeave",rog_ucp_main_img_sms, 
        function () 
            setElementAlpha(rog_ucp_main_img_sms,255) 
        end 
    ) 

Link to comment
just use source not the element name

Okey, i did that. It still dosn't work, this is the result i got:

    -- Alpha Functions -- 
    -- Dim on hover 
    addEventHandler( "onClientMouseEnter", rog_ucp_main_img_sms, 
        function () 
            setElementAlpha(source,100) 
        end 
    ) 
     
    addEventHandler( "onClientMouseEnter", rog_ucp_main, 
        function () 
            setElementAlpha(source,100) 
        end 
    ) 
     
    -- Back when leave 
    addEventHandler("onClientMouseLeave",rog_ucp_main, 
        function () 
            setElementAlpha(source,255) 
        end 
    ) 
     
    addEventHandler("onClientMouseLeave",rog_ucp_main_img_sms, 
        function () 
            setElementAlpha(source,255) 
        end 
    ) 

Link to comment
-- Dim on hover 
addEventHandler( "onClientMouseEnter", root, 
    function ( ) 
        if source == rog_ucp_main_img_sms then 
            guiSetAlpha( source, 100 ) 
        elseif source == rog_ucp_main then 
            guiSetAlpha( source, 100 ) 
        end 
    end 
) 
    
-- Back when leave 
addEventHandler( "onClientMouseLeave", root, 
    function ( ) 
        if source == rog_ucp_main_img_sms then 
            guiSetAlpha( source, 255 ) 
        elseif source == rog_ucp_main then 
            guiSetAlpha( source, 255 ) 
        end 
    end 
    ) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...