Movement of Head

how they are moving characters Head ( left - right - up and down)

http://www.oddcast.com/home/demos/tts/tts_example.php

i tried simple x and y movement and 3d tool in flash

but can’t achieve this

How they are moving ?