title: How to pass arguments into event listener function in flex/actionscript?
body: <p>Since when using sql lite if you try and do a function at the same moment it throws an error, im just trying to make a function that will check if its executing, and if it is try again in 10 milliseconds, this exact function works fine if i dont have to pass any arguments to the function but im confused how I can pass the vars back into the function it'll be executing.</p>
  
  <p>I want to do:</p>
  
  <pre><code>timer.addEventListener(TimerEvent.TIMER, saveChat(username, chatBoxText));
  </code></pre>
  
  <p>But it will only allow me to do:</p>
  
  <pre><code>timer.addEventListener(TimerEvent.TIMER, saveChat);
  </code></pre>
  
  <p>It gives me this compile error:</p>
  
  <blockquote>
    <p><strong>1067:</strong> Implicit coercion of a value of
    type void to an unrelated type
    Function</p>
  </blockquote>
  
  <p>How can I get this to pass this limitation?</p>
  
  <p>Here's what I've got:</p>
  
  <pre><code>public function saveChat(username:String, chatBoxText:String, e:TimerEvent=null):void
  {
      var timer:Timer = new Timer(10, 1);
      timer.addEventListener(TimerEvent.TIMER, saveChat);
  
      if(!saveChatSql.executing)
      {
          saveChatSql.text = "UPDATE active_chats SET convo = '"+chatBoxText+"' WHERE username = '"+username+"';";
          saveChatSql.execute();
      }
      else timer.start();
  }
  </code></pre>