Jump to content

Timer argumant problem


Recommended Posts

Hi everyone, I'm scripting the animation class.But I have an problem at timer...

It's the first code

_G["animateComplete"] = function() 
        -- animate complete content 
    end 
     
    _G["animateBack"] = function() 
        -- animate back content 
    end 
     
     
    anim.animateComplete = animateComplete 
    anim.animateBack = animateBack 

2 Function works fine at class functions.EX:

  
function Animation:Play() 
    addEventHandler('onClientRender',getRootElement(),self.animateComplete) 
end 

It works.But I Have problem because 2 doesn't work at other functions:

  
function addAnimBack(animfunc) 
    -- outputChatBox(type(animfunc)) but it outputs "nil". 
    addEventHandler("onClientRender",getRootElement(), animfunc)-- this isn't work because it's nil. 
end 
  
function Animation:animFinished() 
    if isTimer(self.backTimer) then  
        -- bla bla 
    else 
        removeEventHandler("onClientRender",getRootElement(), self.animateComplete) 
        if (self.animateProperties.onFinishBack >= 50) then 
                        -- outputChatBox(type(self.animateBack)) == It outputs "function" 
            self.backTimer = setTimer(addAnimBack,self.animateProperties.onFinishBack,1,self.animateBack) 
            return 
        end 
    end 
  
     
    -- blala blala 
end 

Where is the problem? Why timer sends nill ?

Edited by Guest
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...