Reference Function Inside of Function

How can I reference a function inside of a function using OOP.

I am trying to do this.


with_field.onkeydown = function(event){
	associate_search.fill_list.down_key(event);
}

Where in another file I have this type of setup.


function associate_search (){
     this.fill_list      =  fill_list;

     function fill_list(){
           //do stuff
           
           function down_key(event){
                  //do stuff
           }
     }
}

var associate_search	= new associate_search;

How can I reference the down_key function?

down_key is private to fill_list. If down_key is to become an event handler, then a reference to it can be returned:

<script type='text/javascript'>

function associate_search ()
{
  this.fill_list =  fill_list;
 
  function fill_list()
  {
    //do stuff
    alert('fill_list called');
                  
    return function down_key(event)
    {
      alert( 'down_key called' );
    }
  }
}
 
var as = new associate_search;

window.onkeydown = as.fill_list();

</script>