Jump to content

onClientMouseMove


IIIIlllllIII

Recommended Posts

hi

how i make the sound playing for 1 time when i move the mouse on gui button or gui window

i want when i move the mouse on button the sound play for 1 time not replay agine

this the code

===================================================

addEventHandler("onClientMouseMove", getRootElement(), function()

if source == Button then

playSound("sot.mp3")

end

end

)

================================================

the problem when i move the mouse on button the sound replay agine on the button when i select the button

how i stop the sound without replay agine on the button

i hope you understand me 8)

Link to comment
function play () 
    if source == Button then 
    local me = playSound("sot.mp3")  
    setSoundVolume(me, 0.-- s8) -->
end 
addEventHandler( "onClientMouseMove", getRootElement( ), play) 
  
function stop () 
if source == Button then 
stopSound("me") 
end 
addEventHandler("onClientMouseLeave", getRootElement(), stop) 

Edited by Guest
Link to comment

Since the event is triggered every time mouse moves over the GUI element. I suggest you use onClientMouseEnter instead which is triggered only when mouse enters the gui element bounding box.

That is:

addEventHandler("onClientMouseEnter", root, function() 
    playSound("sot.mp3"); 
end) 

Link to comment
Since the event is triggered every time mouse moves over the GUI element. I suggest you use onClientMouseEnter instead which is triggered only when mouse enters the gui element bounding box.

That is:

addEventHandler("onClientMouseEnter", root, function() 
    playSound("sot.mp3"); 
end) 

50p

Wow thanks you works great

Link to comment
That will be triggered for any GUI element.
addEventHandler("onClientMouseEnter", Button, function() 
    playSound("sot.mp3"); 
end) 

Yes, isn't that what author of the topic wanted?

MOJRM-511, you're welcome. Have fun scripting and don't hesitate to ask here or IRC.

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...