[AS] dragger.onPress=function()

I am currently working on the Slider Bars tutorial at http://www.kirupa.com/developer/mx/slider.htm . I got dragger to work, I just want to better understand the dragger.onPress=function() part.

With a normal function you have:
function hello(){

Then when I wanted to run the function, I would use:

Ok so if dragger is pressed (onPress) then it creates a function, right? So how do you run the function? Or is the function running as I’m pressing dragger?

I hope you can understand my question.