Webcams/Motion Detection

Hi all, i’ve just got myself a webcam and have been playing around with FMS, i want to do a bit more than just stream live video, it’s kinda an experiment really the guy i sit next to a work is the subject of my webcam monitor (he doesn’t know it yet) and i really want to do some trick stuff with motion detection. i saw this:

which is really impressive, has anyone got source files of some as2 webcam tricks or links i could take a look at its all a bit new to me and i’d like to read more/play around a bit more.