Puma Posted February 22, 2011 Share Posted February 22, 2011 This works: setTimer(function () removeEventHandler("onClientRender", getRootElement(), clientRenderLogo) end, 5000, 1) This doesn't: setTimer(removeEventHandler, 5000, 1, "onClientRender", getRootElement(), clientRenderLogo) Why doesn't the second way work? Link to comment
Castillo Posted February 22, 2011 Share Posted February 22, 2011 A friend had the same problem o_o, maybe it's a bug? Link to comment
#Paper Posted February 22, 2011 Share Posted February 22, 2011 This works: setTimer(function () removeEventHandler("onClientRender", getRootElement(), clientRenderLogo) end, 5000, 1) This doesn't: setTimer(removeEventHandler, 5000, 1, "onClientRender", getRootElement(), clientRenderLogo) Why doesn't the second way work? i think that the 1° works just because the timer need the function () ....... end and you can't insert just removeEventHandler but you must connect a function writed by you, not a function like removeEventHandler . Link to comment
DiSaMe Posted February 22, 2011 Share Posted February 22, 2011 setTimer needs the function and it's all fine about that. function() ... end is a function definition, while removeEventHandler is a variable which holds the function. I see where the real problem may be. If the function clientRenderLogo is defined after the timer is created, then it means that nil value was used as a parameter for removeEventHandler. So you need to move setTimer after the function definition. But if it's already done in this way, I don't know what is the problem. Link to comment
#Paper Posted February 22, 2011 Share Posted February 22, 2011 setTimer needs the function and it's all fine about that. function() ... end is a function definition, while removeEventHandler is a variable which holds the function. I see where the real problem may be. If the function clientRenderLogo is defined after the timer is created, then it means that nil value was used as a parameter for removeEventHandler. So you need to move setTimer after the function definition. But if it's already done in this way, I don't know what is the problem. i meant that 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