papam77 Posted June 20, 2013 Share Posted June 20, 2013 Hello, how can make alpha changing if i enter with mouse to my image? lobby = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "images/lobbyBG.png", true) arenas = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "images/arenas.png", true) dm = guiCreateStaticImage(0.157, 0.19, 0.17, 0.305, "images/areny/dm.png", true, arenas) dd = guiCreateStaticImage(0.331, 0.19, 0.17, 0.305, "images/areny/dm.png", true, arenas) guiSetAlpha ( dm, 0.75 ) guiSetAlpha ( dd, 0.75 ) This is code for images alpha must be 1.00 if player enter to the button. How can do that? Link to comment
iPrestege Posted June 20, 2013 Share Posted June 20, 2013 Event's : onClientMouseEnter onClientMouseLeave Function : guiSetAlpha Link to comment
Dealman Posted June 20, 2013 Share Posted June 20, 2013 Use the event onClientMouseEvent, and when the mouse is over the specified GUI Element it will trigger the function, for example; function onClientMouseHoverSetAlpha() if(source == dm) then guiSetAlpha(dm, 0.75) elseif(source == dd) then guiSetAlpha(dd, 0.75) end end addEventHandler("onClientMouseEnter", getRootElement(), onClientMouseHoverSetAlpha) Remember that you will also have to make it so it sets the Alpha back to the default when the mouse is not hovering over any of the specified elements. Link to comment
Moderators IIYAMA Posted June 20, 2013 Moderators Share Posted June 20, 2013 I was already writing this,,,, so I post it any way. local guiTable = { ["lobby"]= guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "images/lobbyBG.png", true), ["arenas"]= guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "images/arenas.png", true), ["dm"]= guiCreateStaticImage(0.157, 0.19, 0.17, 0.305, "images/areny/dm.png", true, arenas), ["dd"]= guiCreateStaticImage(0.331, 0.19, 0.17, 0.305, "images/areny/dm.png", true, arenas) } guiSetAlpha ( guiTable["dm"], 0.75 ) guiSetAlpha ( guiTable["dd"], 0.75 ) addEventHandler( "onClientMouseEnter", root, function(aX, aY) for key,gui in pairs (guiTable) do if gui == source then guiSetAlpha ( source, 1 ) return end end end ) Link to comment
Dealman Posted June 20, 2013 Share Posted June 20, 2013 I was already writing this,,,, so I post it any way. No need to make it over-the-top with tables when you could just use onClientMouseLeave to return the Alpha to 1 :3 Link to comment
Moderators IIYAMA Posted June 20, 2013 Moderators Share Posted June 20, 2013 I did start writing it before you post anything. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now