Detecting mouse movements?

Hello

I need help pls with figuring out mouse actions that involve movement.

  1. Lets say I want to rub a lamp and make a genie appear. What codes do I need to detect when the mouse is clicked and dragged back and forth the lamp a few times and then the genie effect appears? (Uh, either movieclip or jump to frame??)

  2. I saw the slapping game where u drag ur curser and then the character slaps her enemy. What codes would I need?

Thanks